Activate tests
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@397265 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
9d5786ae26
commit
200edd58da
2 files changed
+42
-17
No files matched your search
@@ -96,6 +96,11 @@
|
||||
<version>1.4</version>
|
||||
<url>http://www.dom4j.org/</url>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jaxen</groupId>
|
||||
<artifactId>jaxen</artifactId>
|
||||
<version>1.1-beta-8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
@@ -124,4 +129,21 @@
|
||||
</properties>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<unitTest>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>org/apache/maven/html2xdoc</targetPath>
|
||||
<directory>src/test/org/apache/maven/html2xdoc/</directory>
|
||||
<includes>
|
||||
<include>**/*.html</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<includes>
|
||||
<include>**/*Test*.java</include>
|
||||
</includes>
|
||||
</unitTest>
|
||||
</build>
|
||||
</project>
|
||||
@@ -93,17 +93,17 @@ public class TestHtml2Xdoc extends TestCase
|
||||
|
||||
public static void main( String[] args )
|
||||
{
|
||||
TestRunner.run( suite( ) );
|
||||
TestRunner.run( suite() );
|
||||
}
|
||||
|
||||
public static Test suite( )
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( TestHtml2Xdoc.class );
|
||||
}
|
||||
|
||||
// Test cases
|
||||
//-------------------------------------------------------------------------
|
||||
public void testOne( ) throws Exception
|
||||
public void testOne() throws Exception
|
||||
{
|
||||
assertConversion( "missingParaBug.html", "missingParaBug.xml" );
|
||||
assertConversion( "linkInHeading.html", "linkInHeading.xml" );
|
||||
@@ -122,7 +122,7 @@ public class TestHtml2Xdoc extends TestCase
|
||||
protected void assertConversion( String input, String output )
|
||||
throws Exception
|
||||
{
|
||||
Html2XdocBean converter = createConverter( );
|
||||
Html2XdocBean converter = createConverter();
|
||||
Document inputDoc = parseHtml( input );
|
||||
|
||||
Document expectedDoc = parse( output );
|
||||
@@ -132,10 +132,10 @@ public class TestHtml2Xdoc extends TestCase
|
||||
if ( verbose )
|
||||
{
|
||||
System.out.println( "Comparing: " + input + " to: " + output );
|
||||
System.out.println( "Parsed: " + inputDoc.asXML( ) );
|
||||
System.out.println( "Generated: " + actualDoc.asXML( ) );
|
||||
System.out.println( );
|
||||
System.out.println( );
|
||||
System.out.println( "Parsed: " + inputDoc.asXML() );
|
||||
System.out.println( "Generated: " + actualDoc.asXML() );
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
assertEqual( "Output for: " + input + " does not match: " + output,
|
||||
@@ -171,14 +171,15 @@ public class TestHtml2Xdoc extends TestCase
|
||||
protected String getPrettyPrintText( Document doc )
|
||||
throws IOException
|
||||
{
|
||||
OutputFormat format = OutputFormat.createPrettyPrint( );
|
||||
StringWriter buffer = new StringWriter( );
|
||||
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||
format.setPadText( false );
|
||||
StringWriter buffer = new StringWriter();
|
||||
XMLWriter writer = new XMLWriter( buffer, format );
|
||||
|
||||
writer.write( doc );
|
||||
writer.close( );
|
||||
writer.close();
|
||||
|
||||
return buffer.toString( );
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +192,9 @@ public class TestHtml2Xdoc extends TestCase
|
||||
throws Exception
|
||||
{
|
||||
URL url = getClassURL( input );
|
||||
SAXReader saxReader = new SAXReader( );
|
||||
SAXReader saxReader = new SAXReader();
|
||||
saxReader.setMergeAdjacentText( true );
|
||||
saxReader.setStripWhitespaceText( true );
|
||||
|
||||
return saxReader.read( url );
|
||||
}
|
||||
@@ -207,7 +210,7 @@ public class TestHtml2Xdoc extends TestCase
|
||||
throws Exception
|
||||
{
|
||||
URL url = getClassURL( input );
|
||||
SAXParser htmlParser = new SAXParser( );
|
||||
SAXParser htmlParser = new SAXParser();
|
||||
|
||||
htmlParser.setProperty( "http://cyberneko.org/html/properties/names/elems",
|
||||
"lower" );
|
||||
@@ -222,7 +225,7 @@ public class TestHtml2Xdoc extends TestCase
|
||||
protected URL getClassURL( String input )
|
||||
throws Exception
|
||||
{
|
||||
URL url = getClass( ).getResource( input );
|
||||
URL url = getClass().getResource( input );
|
||||
|
||||
assertTrue( "Could not find resource on classpath for: " + input,
|
||||
url != null );
|
||||
@@ -230,8 +233,8 @@ public class TestHtml2Xdoc extends TestCase
|
||||
return url;
|
||||
}
|
||||
|
||||
protected Html2XdocBean createConverter( )
|
||||
protected Html2XdocBean createConverter()
|
||||
{
|
||||
return new Html2XdocBean( );
|
||||
return new Html2XdocBean();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user