mirror of https://github.com/apache/poi.git
add more detailed message about missing substring
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145494 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fd8a518446
commit
bca6a91735
|
@ -37,6 +37,14 @@ import org.apache.poi.hwpf.HWPFDocument;
|
||||||
*/
|
*/
|
||||||
public class TestWordToHtmlConverter extends TestCase
|
public class TestWordToHtmlConverter extends TestCase
|
||||||
{
|
{
|
||||||
|
private static void assertContains( String result, final String substring )
|
||||||
|
{
|
||||||
|
if ( !result.contains( substring ) )
|
||||||
|
fail( "Substring \"" + substring
|
||||||
|
+ "\" not found in the following string: \"" + substring
|
||||||
|
+ "\"" );
|
||||||
|
}
|
||||||
|
|
||||||
private static String getHtmlText( final String sampleFileName )
|
private static String getHtmlText( final String sampleFileName )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -66,58 +74,65 @@ public class TestWordToHtmlConverter extends TestCase
|
||||||
public void testAIOOBTap() throws Exception
|
public void testAIOOBTap() throws Exception
|
||||||
{
|
{
|
||||||
String result = getHtmlText( "AIOOB-Tap.doc" );
|
String result = getHtmlText( "AIOOB-Tap.doc" );
|
||||||
assertTrue( result.substring( 0, 2000 ).contains( "<table>" ) );
|
assertContains( result.substring( 0, 2000 ), "<table>" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug33519() throws Exception
|
public void testBug33519() throws Exception
|
||||||
{
|
{
|
||||||
String result = getHtmlText( "Bug33519.doc" );
|
String result = getHtmlText( "Bug33519.doc" );
|
||||||
assertTrue( result.contains( "Планински турове" ) );
|
assertContains( result, "Планински турове" );
|
||||||
assertTrue( result.contains( "Явор Асенов" ) );
|
assertContains( result, "Явор Асенов" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug46610_2() throws Exception
|
public void testBug46610_2() throws Exception
|
||||||
{
|
{
|
||||||
String result = getHtmlText( "Bug46610_2.doc" );
|
String result = getHtmlText( "Bug46610_2.doc" );
|
||||||
assertTrue( result
|
assertContains(
|
||||||
.contains( "012345678911234567892123456789312345678941234567890123456789112345678921234567893123456789412345678" ) );
|
result,
|
||||||
|
"012345678911234567892123456789312345678941234567890123456789112345678921234567893123456789412345678" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug46817() throws Exception
|
public void testBug46817() throws Exception
|
||||||
{
|
{
|
||||||
String result = getHtmlText( "Bug46817.doc" );
|
String result = getHtmlText( "Bug46817.doc" );
|
||||||
assertTrue( result.contains( "<table>" ) );
|
final String substring = "<table>";
|
||||||
|
assertContains( result, substring );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug48075() throws Exception
|
||||||
|
{
|
||||||
|
getHtmlText( "Bug48075.doc" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDocumentProperties() throws Exception
|
public void testDocumentProperties() throws Exception
|
||||||
{
|
{
|
||||||
String result = getHtmlText( "documentProperties.doc" );
|
String result = getHtmlText( "documentProperties.doc" );
|
||||||
|
|
||||||
assertTrue( result.contains( "<title>This is document title</title>" ) );
|
assertContains( result, "<title>This is document title</title>" );
|
||||||
assertTrue( result
|
assertContains( result,
|
||||||
.contains( "<meta content=\"This is document keywords\" name=\"keywords\">" ) );
|
"<meta content=\"This is document keywords\" name=\"keywords\">" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEmailhyperlink() throws Exception
|
public void testEmailhyperlink() throws Exception
|
||||||
{
|
{
|
||||||
String result = getHtmlText( "Bug47286.doc" );
|
String result = getHtmlText( "Bug47286.doc" );
|
||||||
assertTrue( result.contains( "provisastpet@mfa.gov.cy" ) );
|
final String substring = "provisastpet@mfa.gov.cy";
|
||||||
|
assertContains( result, substring );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEquation() throws Exception
|
public void testEquation() throws Exception
|
||||||
{
|
{
|
||||||
String result = getHtmlText( "equation.doc" );
|
String result = getHtmlText( "equation.doc" );
|
||||||
|
|
||||||
assertTrue( result
|
assertContains( result, "<!--Image link to '0.emf' can be here-->" );
|
||||||
.contains( "<!--Image link to '0.emf' can be here-->" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHyperlink() throws Exception
|
public void testHyperlink() throws Exception
|
||||||
{
|
{
|
||||||
String result = getHtmlText( "hyperlink.doc" );
|
String result = getHtmlText( "hyperlink.doc" );
|
||||||
|
|
||||||
assertTrue( result.contains( "<a href=\"http://testuri.org/\">" ) );
|
assertContains( result, "<a href=\"http://testuri.org/\">" );
|
||||||
assertTrue( result.contains( "Hyperlink text" ) );
|
assertContains( result, "Hyperlink text" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInnerTable() throws Exception
|
public void testInnerTable() throws Exception
|
||||||
|
@ -125,11 +140,6 @@ public class TestWordToHtmlConverter extends TestCase
|
||||||
getHtmlText( "innertable.doc" );
|
getHtmlText( "innertable.doc" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug48075() throws Exception
|
|
||||||
{
|
|
||||||
getHtmlText( "Bug48075.doc" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testO_kurs_doc() throws Exception
|
public void testO_kurs_doc() throws Exception
|
||||||
{
|
{
|
||||||
getHtmlText( "o_kurs.doc" );
|
getHtmlText( "o_kurs.doc" );
|
||||||
|
@ -139,7 +149,7 @@ public class TestWordToHtmlConverter extends TestCase
|
||||||
{
|
{
|
||||||
String result = getHtmlText( "pageref.doc" );
|
String result = getHtmlText( "pageref.doc" );
|
||||||
|
|
||||||
assertTrue( result.contains( "<a href=\"#userref\">" ) );
|
assertContains( result, "<a href=\"#userref\">" );
|
||||||
assertTrue( result.contains( "1" ) );
|
assertContains( result, "1" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue