[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/nodeDecoratorTests AllTests.java,1.7,1.8 Decodi
Brought to you by:
derrickoswald
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/nodeDecoratorTests In directory sc8-pr-cvs1:/tmp/cvs-serv31228/tests/nodeDecoratorTests Modified Files: AllTests.java DecodingNodeTest.java EscapeCharacterRemovingNodeTest.java NonBreakingSpaceConvertingNodeTest.java Log Message: Change tabs to spaces in all source files. Index: AllTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/nodeDecoratorTests/AllTests.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AllTests.java 24 Aug 2003 21:59:43 -0000 1.7 --- AllTests.java 3 Sep 2003 23:36:21 -0000 1.8 *************** *** 33,47 **** public class AllTests extends junit.framework.TestCase { ! public AllTests(String name) { ! super(name); ! } ! public static TestSuite suite() { ! TestSuite suite = new TestSuite("Node Decorator Tests"); ! suite.addTestSuite(DecodingNodeTest.class); ! suite.addTestSuite(EscapeCharacterRemovingNodeTest.class); ! suite.addTestSuite(NonBreakingSpaceConvertingNodeTest.class); ! return suite; ! } /** --- 33,47 ---- public class AllTests extends junit.framework.TestCase { ! public AllTests(String name) { ! super(name); ! } ! public static TestSuite suite() { ! TestSuite suite = new TestSuite("Node Decorator Tests"); ! suite.addTestSuite(DecodingNodeTest.class); ! suite.addTestSuite(EscapeCharacterRemovingNodeTest.class); ! suite.addTestSuite(NonBreakingSpaceConvertingNodeTest.class); ! return suite; ! } /** Index: DecodingNodeTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/nodeDecoratorTests/DecodingNodeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DecodingNodeTest.java 24 Aug 2003 21:59:43 -0000 1.8 --- DecodingNodeTest.java 3 Sep 2003 23:36:21 -0000 1.9 *************** *** 38,131 **** public class DecodingNodeTest extends ParserTestCase { ! public DecodingNodeTest(String name) { ! super(name); ! } ! private String parseToObtainDecodedResult(String STRING_TO_DECODE) ! throws ParserException { ! StringBuffer decodedContent = new StringBuffer(); ! StringNodeFactory stringNodeFactory = new StringNodeFactory(); ! stringNodeFactory.setNodeDecoding(true); ! createParser(STRING_TO_DECODE); ! parser.setStringNodeFactory(stringNodeFactory); ! NodeIterator nodes = parser.elements(); ! ! while (nodes.hasMoreNodes()) ! decodedContent.append(nodes.nextNode().toPlainTextString()); ! return decodedContent.toString(); ! } ! public void testAmpersand() throws Exception { ! String ENCODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop"; ! ! String DECODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop"; ! assertEquals( ! "ampersand in string", ! DECODED_WORKSHOP_TITLE, ! parseToObtainDecodedResult(ENCODED_WORKSHOP_TITLE)); ! } ! public void testNumericReference() throws Exception { ! String ENCODED_DIVISION_SIGN = ! "÷ is the division sign."; ! ! String DECODED_DIVISION_SIGN = ! "÷ is the division sign."; ! ! assertEquals( ! "numeric reference for division sign", ! DECODED_DIVISION_SIGN, ! parseToObtainDecodedResult(ENCODED_DIVISION_SIGN)); ! } ! ! ! public void testReferencesInString () throws Exception { ! String ENCODED_REFERENCE_IN_STRING = ! "Thus, the character entity reference ÷ is a more convenient" + ! " form than ÷ for obtaining the division sign (÷)"; ! ! String DECODED_REFERENCE_IN_STRING = ! "Thus, the character entity reference ÷ is a more convenient" + ! " form than ÷ for obtaining the division sign (÷)"; ! ! assertEquals ( ! "character references within a string", ! DECODED_REFERENCE_IN_STRING, ! parseToObtainDecodedResult(ENCODED_REFERENCE_IN_STRING)); ! } ! public void testBogusCharacterEntityReference() throws Exception { ! ! String ENCODED_BOGUS_CHARACTER_ENTITY = ! "The character entity reference &divode; is bogus"; ! ! String DECODED_BOGUS_CHARACTER_ENTITY = ! "The character entity reference &divode; is bogus"; ! ! assertEquals ( ! "bogus character entity reference", ! DECODED_BOGUS_CHARACTER_ENTITY, ! parseToObtainDecodedResult(ENCODED_BOGUS_CHARACTER_ENTITY)); ! } ! ! public void testDecodingNonBreakingSpaceDoesNotOccur() throws Exception { ! ! String ENCODED_WITH_NON_BREAKING_SPACE = ! "Here is string with \u00a0."; ! ! String DECODED_WITH_NON_BREAKING_SPACE = ! "Here is string with \u00a0."; ! ! assertEquals ( ! "bogus character entity reference", ! DECODED_WITH_NON_BREAKING_SPACE, ! parseToObtainDecodedResult(ENCODED_WITH_NON_BREAKING_SPACE)); ! } ! ! } --- 38,131 ---- public class DecodingNodeTest extends ParserTestCase { ! public DecodingNodeTest(String name) { ! super(name); ! } ! private String parseToObtainDecodedResult(String STRING_TO_DECODE) ! throws ParserException { ! StringBuffer decodedContent = new StringBuffer(); ! StringNodeFactory stringNodeFactory = new StringNodeFactory(); ! stringNodeFactory.setNodeDecoding(true); ! createParser(STRING_TO_DECODE); ! parser.setStringNodeFactory(stringNodeFactory); ! NodeIterator nodes = parser.elements(); ! ! while (nodes.hasMoreNodes()) ! decodedContent.append(nodes.nextNode().toPlainTextString()); ! return decodedContent.toString(); ! } ! public void testAmpersand() throws Exception { ! String ENCODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop"; ! ! String DECODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop"; ! assertEquals( ! "ampersand in string", ! DECODED_WORKSHOP_TITLE, ! parseToObtainDecodedResult(ENCODED_WORKSHOP_TITLE)); ! } ! public void testNumericReference() throws Exception { ! String ENCODED_DIVISION_SIGN = ! "÷ is the division sign."; ! ! String DECODED_DIVISION_SIGN = ! "÷ is the division sign."; ! ! assertEquals( ! "numeric reference for division sign", ! DECODED_DIVISION_SIGN, ! parseToObtainDecodedResult(ENCODED_DIVISION_SIGN)); ! } ! ! ! public void testReferencesInString () throws Exception { ! String ENCODED_REFERENCE_IN_STRING = ! "Thus, the character entity reference ÷ is a more convenient" + ! " form than ÷ for obtaining the division sign (÷)"; ! ! String DECODED_REFERENCE_IN_STRING = ! "Thus, the character entity reference ÷ is a more convenient" + ! " form than ÷ for obtaining the division sign (÷)"; ! ! assertEquals ( ! "character references within a string", ! DECODED_REFERENCE_IN_STRING, ! parseToObtainDecodedResult(ENCODED_REFERENCE_IN_STRING)); ! } ! public void testBogusCharacterEntityReference() throws Exception { ! ! String ENCODED_BOGUS_CHARACTER_ENTITY = ! "The character entity reference &divode; is bogus"; ! ! String DECODED_BOGUS_CHARACTER_ENTITY = ! "The character entity reference &divode; is bogus"; ! ! assertEquals ( ! "bogus character entity reference", ! DECODED_BOGUS_CHARACTER_ENTITY, ! parseToObtainDecodedResult(ENCODED_BOGUS_CHARACTER_ENTITY)); ! } ! ! public void testDecodingNonBreakingSpaceDoesNotOccur() throws Exception { ! ! String ENCODED_WITH_NON_BREAKING_SPACE = ! "Here is string with \u00a0."; ! ! String DECODED_WITH_NON_BREAKING_SPACE = ! "Here is string with \u00a0."; ! ! assertEquals ( ! "bogus character entity reference", ! DECODED_WITH_NON_BREAKING_SPACE, ! parseToObtainDecodedResult(ENCODED_WITH_NON_BREAKING_SPACE)); ! } ! ! } Index: EscapeCharacterRemovingNodeTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/nodeDecoratorTests/EscapeCharacterRemovingNodeTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EscapeCharacterRemovingNodeTest.java 24 Aug 2003 21:59:43 -0000 1.8 --- EscapeCharacterRemovingNodeTest.java 3 Sep 2003 23:36:21 -0000 1.9 *************** *** 37,112 **** public class EscapeCharacterRemovingNodeTest extends ParserTestCase { ! public EscapeCharacterRemovingNodeTest(String name) { ! super(name); ! } ! private String parseToObtainDecodedResult(String STRING_TO_DECODE) ! throws ParserException { ! StringBuffer decodedContent = new StringBuffer(); ! StringNodeFactory stringNodeFactory = new StringNodeFactory(); ! stringNodeFactory.setEscapeCharacterRemoval(true); ! createParser(STRING_TO_DECODE); ! parser.setStringNodeFactory(stringNodeFactory); ! NodeIterator nodes = parser.elements(); ! ! while (nodes.hasMoreNodes()) ! decodedContent.append(nodes.nextNode().toPlainTextString()); ! return decodedContent.toString(); ! } ! public void testTab() throws Exception { ! String ENCODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop\tCreated by Industrial Logic, Inc."; ! ! String DECODED_WORKSHOP_TITLE = ! "The Testing & Refactoring WorkshopCreated by Industrial Logic, Inc."; ! assertEquals( ! "tab in string", ! DECODED_WORKSHOP_TITLE, ! parseToObtainDecodedResult(ENCODED_WORKSHOP_TITLE)); ! } ! ! public void testCarriageReturn() throws Exception { ! String ENCODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop\nCreated by Industrial Logic, Inc.\n"; ! ! String DECODED_WORKSHOP_TITLE = ! "The Testing & Refactoring WorkshopCreated by Industrial Logic, Inc."; ! assertEquals( ! "tab in string", ! DECODED_WORKSHOP_TITLE, ! parseToObtainDecodedResult(ENCODED_WORKSHOP_TITLE)); ! } ! ! public void testWithDecodingNodeDecorator() throws Exception { ! String ENCODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop\nCreated by Industrial Logic, Inc.\n"; ! ! String DECODED_WORKSHOP_TITLE = ! "The Testing & Refactoring WorkshopCreated by Industrial Logic, Inc."; ! StringBuffer decodedContent = new StringBuffer(); ! ! StringNodeFactory stringNodeFactory = new StringNodeFactory(); ! stringNodeFactory.setNodeDecoding(true); ! stringNodeFactory.setEscapeCharacterRemoval(true); ! ! createParser(ENCODED_WORKSHOP_TITLE); ! parser.setStringNodeFactory(stringNodeFactory); ! NodeIterator nodes = parser.elements(); ! ! while (nodes.hasMoreNodes()) ! decodedContent.append(nodes.nextNode().toPlainTextString()); ! assertEquals( ! "tab in string", ! DECODED_WORKSHOP_TITLE, ! decodedContent.toString()); ! ! } } --- 37,112 ---- public class EscapeCharacterRemovingNodeTest extends ParserTestCase { ! public EscapeCharacterRemovingNodeTest(String name) { ! super(name); ! } ! private String parseToObtainDecodedResult(String STRING_TO_DECODE) ! throws ParserException { ! StringBuffer decodedContent = new StringBuffer(); ! StringNodeFactory stringNodeFactory = new StringNodeFactory(); ! stringNodeFactory.setEscapeCharacterRemoval(true); ! createParser(STRING_TO_DECODE); ! parser.setStringNodeFactory(stringNodeFactory); ! NodeIterator nodes = parser.elements(); ! ! while (nodes.hasMoreNodes()) ! decodedContent.append(nodes.nextNode().toPlainTextString()); ! return decodedContent.toString(); ! } ! public void testTab() throws Exception { ! String ENCODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop\tCreated by Industrial Logic, Inc."; ! ! String DECODED_WORKSHOP_TITLE = ! "The Testing & Refactoring WorkshopCreated by Industrial Logic, Inc."; ! assertEquals( ! "tab in string", ! DECODED_WORKSHOP_TITLE, ! parseToObtainDecodedResult(ENCODED_WORKSHOP_TITLE)); ! } ! ! public void testCarriageReturn() throws Exception { ! String ENCODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop\nCreated by Industrial Logic, Inc.\n"; ! ! String DECODED_WORKSHOP_TITLE = ! "The Testing & Refactoring WorkshopCreated by Industrial Logic, Inc."; ! assertEquals( ! "tab in string", ! DECODED_WORKSHOP_TITLE, ! parseToObtainDecodedResult(ENCODED_WORKSHOP_TITLE)); ! } ! ! public void testWithDecodingNodeDecorator() throws Exception { ! String ENCODED_WORKSHOP_TITLE = ! "The Testing & Refactoring Workshop\nCreated by Industrial Logic, Inc.\n"; ! ! String DECODED_WORKSHOP_TITLE = ! "The Testing & Refactoring WorkshopCreated by Industrial Logic, Inc."; ! StringBuffer decodedContent = new StringBuffer(); ! ! StringNodeFactory stringNodeFactory = new StringNodeFactory(); ! stringNodeFactory.setNodeDecoding(true); ! stringNodeFactory.setEscapeCharacterRemoval(true); ! ! createParser(ENCODED_WORKSHOP_TITLE); ! parser.setStringNodeFactory(stringNodeFactory); ! NodeIterator nodes = parser.elements(); ! ! while (nodes.hasMoreNodes()) ! decodedContent.append(nodes.nextNode().toPlainTextString()); ! assertEquals( ! "tab in string", ! DECODED_WORKSHOP_TITLE, ! decodedContent.toString()); ! ! } } Index: NonBreakingSpaceConvertingNodeTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/nodeDecoratorTests/NonBreakingSpaceConvertingNodeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NonBreakingSpaceConvertingNodeTest.java 24 Aug 2003 21:59:43 -0000 1.7 --- NonBreakingSpaceConvertingNodeTest.java 3 Sep 2003 23:36:21 -0000 1.8 *************** *** 37,86 **** public class NonBreakingSpaceConvertingNodeTest extends ParserTestCase { ! public NonBreakingSpaceConvertingNodeTest(String name) { ! super(name); ! } ! private String parseToObtainDecodedResult(String STRING_TO_DECODE) ! throws ParserException { ! StringBuffer decodedContent = new StringBuffer(); ! ! StringNodeFactory stringNodeFactory = new StringNodeFactory(); ! stringNodeFactory.setNonBreakSpaceConversion(true); ! createParser(STRING_TO_DECODE); ! parser.setStringNodeFactory(stringNodeFactory); ! NodeIterator nodes = parser.elements(); ! ! while (nodes.hasMoreNodes()) ! decodedContent.append(nodes.nextNode().toPlainTextString()); ! return decodedContent.toString(); ! } ! public void testOneNonBreakingSpace() throws Exception { ! String ENCODED_WITH_NON_BREAKING_SPACE = ! "Here is string with \u00a0 inside of it."; ! ! String DECODED_WITH_NON_BREAKING_SPACE = ! "Here is string with inside of it."; ! ! assertEquals ( ! "\u00a0 was converted to a space correctly", ! DECODED_WITH_NON_BREAKING_SPACE, ! parseToObtainDecodedResult(ENCODED_WITH_NON_BREAKING_SPACE)); ! } ! ! public void testMultipleNonBreakingSpace() throws Exception { ! String ENCODED_WITH_NON_BREAKING_SPACE = ! "\u00a0Here is string with \u00a0 inside of it\u00a0."; ! ! String DECODED_WITH_NON_BREAKING_SPACE = ! " Here is string with inside of it ."; ! ! assertEquals ( ! "\u00a0 was converted to a space correctly", ! DECODED_WITH_NON_BREAKING_SPACE, ! parseToObtainDecodedResult(ENCODED_WITH_NON_BREAKING_SPACE)); ! } ! } --- 37,86 ---- public class NonBreakingSpaceConvertingNodeTest extends ParserTestCase { ! public NonBreakingSpaceConvertingNodeTest(String name) { ! super(name); ! } ! private String parseToObtainDecodedResult(String STRING_TO_DECODE) ! throws ParserException { ! StringBuffer decodedContent = new StringBuffer(); ! ! StringNodeFactory stringNodeFactory = new StringNodeFactory(); ! stringNodeFactory.setNonBreakSpaceConversion(true); ! createParser(STRING_TO_DECODE); ! parser.setStringNodeFactory(stringNodeFactory); ! NodeIterator nodes = parser.elements(); ! ! while (nodes.hasMoreNodes()) ! decodedContent.append(nodes.nextNode().toPlainTextString()); ! return decodedContent.toString(); ! } ! public void testOneNonBreakingSpace() throws Exception { ! String ENCODED_WITH_NON_BREAKING_SPACE = ! "Here is string with \u00a0 inside of it."; ! ! String DECODED_WITH_NON_BREAKING_SPACE = ! "Here is string with inside of it."; ! ! assertEquals ( ! "\u00a0 was converted to a space correctly", ! DECODED_WITH_NON_BREAKING_SPACE, ! parseToObtainDecodedResult(ENCODED_WITH_NON_BREAKING_SPACE)); ! } ! ! public void testMultipleNonBreakingSpace() throws Exception { ! String ENCODED_WITH_NON_BREAKING_SPACE = ! "\u00a0Here is string with \u00a0 inside of it\u00a0."; ! ! String DECODED_WITH_NON_BREAKING_SPACE = ! " Here is string with inside of it ."; ! ! assertEquals ( ! "\u00a0 was converted to a space correctly", ! DECODED_WITH_NON_BREAKING_SPACE, ! parseToObtainDecodedResult(ENCODED_WITH_NON_BREAKING_SPACE)); ! } ! } |