[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/visitorsTests AllTests.java,1.34,1.35 Composite
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-09-10 03:54:10
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests In directory sc8-pr-cvs1:/tmp/cvs-serv24483/src/org/htmlparser/tests/visitorsTests Modified Files: AllTests.java CompositeTagFindingVisitorTest.java HtmlPageTest.java LinkFindingVisitorTest.java NodeVisitorTest.java StringFindingVisitorTest.java TagFindingVisitorTest.java TextExtractingVisitorTest.java UrlModifyingVisitorTest.java Log Message: Add style checking target to ant build script: ant checkstyle It uses a jar from http://checkstyle.sourceforge.net which is dropped in the lib directory. The rules are in the file htmlparser_checks.xml in the src directory. Added lexerapplications package with Tabby as the first app. It performs whitespace manipulation on source files to follow the style rules. This reduced the number of style violations to roughly 14,000. There are a few issues with the style checker that need to be resolved before it should be taken too seriously. For example: It thinks all method arguments should be final, even if they are modified by the code (which the compiler frowns on). It complains about long lines, even when there is no possibility of wrapping the line, i.e. a URL in a comment that's more than 80 characters long. It considers all naked integers as 'magic numbers', even when they are obvious, i.e. the 4 corners of a box. It complains about whitespace following braces, even in array initializers, i.e. X[][] = { {a, b} { } } But it points out some really interesting things, even if you don't agree with the style guidelines, so it's worth a look. Index: AllTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests/AllTests.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** AllTests.java 8 Sep 2003 02:26:32 -0000 1.34 --- AllTests.java 10 Sep 2003 03:38:25 -0000 1.35 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 31,43 **** import junit.framework.TestSuite; ! public class AllTests extends junit.framework.TestCase { public AllTests(String name) { super(name); } ! public static TestSuite suite() { TestSuite suite = new TestSuite("Visitor Tests"); ! suite.addTestSuite(CompositeTagFindingVisitorTest.class); suite.addTestSuite(HtmlPageTest.class); --- 31,43 ---- import junit.framework.TestSuite; ! public class AllTests extends junit.framework.TestCase { public AllTests(String name) { super(name); } ! public static TestSuite suite() { TestSuite suite = new TestSuite("Visitor Tests"); ! suite.addTestSuite(CompositeTagFindingVisitorTest.class); suite.addTestSuite(HtmlPageTest.class); *************** *** 50,54 **** return suite; ! } /** --- 50,54 ---- return suite; ! } /** *************** *** 94,103 **** * from http://www.mail-archive.com/commons-user%40jakarta.apache.org/msg02958.html * ! * The problem is within the UI test runners of JUnit. They bring ! * with them a custom classloader, which causes the ! * LogConfigurationException. Unfortunately Log4j doesn't work * either. ! * ! * Solution: Disable "Reload classes every run" or start JUnit with * command line option -noloading before the name of the Testsuite. */ --- 94,103 ---- * from http://www.mail-archive.com/commons-user%40jakarta.apache.org/msg02958.html * ! * The problem is within the UI test runners of JUnit. They bring ! * with them a custom classloader, which causes the ! * LogConfigurationException. Unfortunately Log4j doesn't work * either. ! * ! * Solution: Disable "Reload classes every run" or start JUnit with * command line option -noloading before the name of the Testsuite. */ Index: CompositeTagFindingVisitorTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests/CompositeTagFindingVisitorTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CompositeTagFindingVisitorTest.java 8 Sep 2003 02:26:32 -0000 1.7 --- CompositeTagFindingVisitorTest.java 10 Sep 2003 03:38:25 -0000 1.8 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com Index: HtmlPageTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests/HtmlPageTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** HtmlPageTest.java 8 Sep 2003 02:26:32 -0000 1.10 --- HtmlPageTest.java 10 Sep 2003 03:38:25 -0000 1.11 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 40,44 **** public class HtmlPageTest extends ParserTestCase { ! private static final String SIMPLE_PAGE = "<html>" + "<head>" + --- 40,44 ---- public class HtmlPageTest extends ParserTestCase { ! private static final String SIMPLE_PAGE = "<html>" + "<head>" + *************** *** 50,54 **** "</html>"; ! private static final String PAGE_WITH_TABLE = "<html>" + "<head>" + --- 50,54 ---- "</html>"; ! private static final String PAGE_WITH_TABLE = "<html>" + "<head>" + *************** *** 65,69 **** "</body>" + "</html>"; ! public HtmlPageTest(String name) { super(name); --- 65,69 ---- "</body>" + "</html>"; ! public HtmlPageTest(String name) { super(name); *************** *** 71,75 **** public void testCreateSimplePage() throws Exception { ! createParser( SIMPLE_PAGE ); --- 71,75 ---- public void testCreateSimplePage() throws Exception { ! createParser( SIMPLE_PAGE ); *************** *** 93,99 **** ); } ! public void testCreatePageWithTables() throws Exception { ! createParser( PAGE_WITH_TABLE ); --- 93,99 ---- ); } ! public void testCreatePageWithTables() throws Exception { ! createParser( PAGE_WITH_TABLE ); *************** *** 112,116 **** "</table>", bodyNodes.asHtml() ! ); TableTag tables [] = page.getTables(); assertEquals("number of tables",1,tables.length); --- 112,116 ---- "</table>", bodyNodes.asHtml() ! ); TableTag tables [] = page.getTables(); assertEquals("number of tables",1,tables.length); Index: LinkFindingVisitorTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests/LinkFindingVisitorTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** LinkFindingVisitorTest.java 8 Sep 2003 02:26:32 -0000 1.7 --- LinkFindingVisitorTest.java 10 Sep 2003 03:38:25 -0000 1.8 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 33,37 **** public class LinkFindingVisitorTest extends ParserTestCase { ! private String html = "<HTML><HEAD><TITLE>This is the Title</TITLE></HEAD><BODY>Hello World, <A href=\"http://www.industriallogic.com\">Industrial Logic</a></BODY></HTML>"; --- 33,37 ---- public class LinkFindingVisitorTest extends ParserTestCase { ! private String html = "<HTML><HEAD><TITLE>This is the Title</TITLE></HEAD><BODY>Hello World, <A href=\"http://www.industriallogic.com\">Industrial Logic</a></BODY></HTML>"; *************** *** 48,51 **** assertEquals("Link Count",1,visitor.getCount()); } ! } --- 48,51 ---- assertEquals("Link Count",1,visitor.getCount()); } ! } Index: NodeVisitorTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests/NodeVisitorTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NodeVisitorTest.java 8 Sep 2003 02:26:32 -0000 1.7 --- NodeVisitorTest.java 10 Sep 2003 03:38:25 -0000 1.8 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 42,46 **** super(name); } ! public void testVisitTag() throws Exception { ParameterVisitor visitor = new ParameterVisitor(); --- 42,46 ---- super(name); } ! public void testVisitTag() throws Exception { ParameterVisitor visitor = new ParameterVisitor(); *************** *** 52,71 **** ); parser.visitAllNodesWith(visitor); ! assertEquals("value of key1","value1",visitor.getValue("key1")); assertEquals("value of key2","value2",visitor.getValue("key2")); } ! class ParameterVisitor extends NodeVisitor { Map paramsMap = new HashMap(); String lastKeyVisited; ! public String getValue(String key) { return (String)paramsMap.get(key); } ! public void visitStringNode(StringNode stringNode) { paramsMap.put(lastKeyVisited,stringNode.getText()); } ! public void visitTag(Tag tag) { if (tag.getTagName().equals("PARAM")) { --- 52,71 ---- ); parser.visitAllNodesWith(visitor); ! assertEquals("value of key1","value1",visitor.getValue("key1")); assertEquals("value of key2","value2",visitor.getValue("key2")); } ! class ParameterVisitor extends NodeVisitor { Map paramsMap = new HashMap(); String lastKeyVisited; ! public String getValue(String key) { return (String)paramsMap.get(key); } ! public void visitStringNode(StringNode stringNode) { paramsMap.put(lastKeyVisited,stringNode.getText()); } ! public void visitTag(Tag tag) { if (tag.getTagName().equals("PARAM")) { Index: StringFindingVisitorTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests/StringFindingVisitorTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** StringFindingVisitorTest.java 8 Sep 2003 02:26:32 -0000 1.9 --- StringFindingVisitorTest.java 10 Sep 2003 03:38:25 -0000 1.10 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 33,45 **** public class StringFindingVisitorTest extends ParserTestCase { ! private static final String HTML = "<HTML><HEAD><TITLE>This is the Title</TITLE>" + "</HEAD><BODY>Hello World, this is an excellent parser</BODY></HTML>"; ! ! private static final String HTML_TO_SEARCH = "<HTML><HEAD><TITLE>test</TITLE></HEAD>\n"+ "<BODY><H1>This is a test page</H1>\n"+ "Writing tests is good for code. Testing is a good\n"+ ! "philosophy. Test driven development is even better.\n"; public StringFindingVisitorTest(String name) { --- 33,45 ---- public class StringFindingVisitorTest extends ParserTestCase { ! private static final String HTML = "<HTML><HEAD><TITLE>This is the Title</TITLE>" + "</HEAD><BODY>Hello World, this is an excellent parser</BODY></HTML>"; ! ! private static final String HTML_TO_SEARCH = "<HTML><HEAD><TITLE>test</TITLE></HEAD>\n"+ "<BODY><H1>This is a test page</H1>\n"+ "Writing tests is good for code. Testing is a good\n"+ ! "philosophy. Test driven development is even better.\n"; public StringFindingVisitorTest(String name) { *************** *** 53,57 **** assertTrue("Hello found", visitor.stringWasFound()); } ! public void testStringNotFound() throws Exception { createParser(HTML); --- 53,57 ---- assertTrue("Hello found", visitor.stringWasFound()); } ! public void testStringNotFound() throws Exception { createParser(HTML); *************** *** 60,64 **** assertTrue("industrial logic should not have been found", !visitor.stringWasFound()); } ! public void testStringInTagNotFound() throws Exception { createParser(HTML); --- 60,64 ---- assertTrue("industrial logic should not have been found", !visitor.stringWasFound()); } ! public void testStringInTagNotFound() throws Exception { createParser(HTML); *************** *** 74,78 **** assertTrue("text should be found", visitor.stringWasFound()); } ! public void testStringFoundCount() throws Exception { createParser(HTML); --- 74,78 ---- assertTrue("text should be found", visitor.stringWasFound()); } ! public void testStringFoundCount() throws Exception { createParser(HTML); *************** *** 80,84 **** parser.visitAllNodesWith(visitor); assertEquals("# times 'is' was found", 2, visitor.stringFoundCount()); ! visitor = new StringFindingVisitor("and"); parser.visitAllNodesWith(visitor); --- 80,84 ---- parser.visitAllNodesWith(visitor); assertEquals("# times 'is' was found", 2, visitor.stringFoundCount()); ! visitor = new StringFindingVisitor("and"); parser.visitAllNodesWith(visitor); *************** *** 94,98 **** } ! ! } --- 94,98 ---- } ! ! } Index: TagFindingVisitorTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests/TagFindingVisitorTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TagFindingVisitorTest.java 8 Sep 2003 02:26:32 -0000 1.10 --- TagFindingVisitorTest.java 10 Sep 2003 03:38:25 -0000 1.11 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 35,39 **** public class TagFindingVisitorTest extends ParserTestCase { ! private String html = "<HTML><HEAD><TITLE>This is the Title</TITLE></HEAD>" + "<BODY>Hello World, this is an excellent parser</BODY>" + --- 35,39 ---- public class TagFindingVisitorTest extends ParserTestCase { ! private String html = "<HTML><HEAD><TITLE>This is the Title</TITLE></HEAD>" + "<BODY>Hello World, this is an excellent parser</BODY>" + *************** *** 45,49 **** super(name); } ! public void setUp() { createParser(html); --- 45,49 ---- super(name); } ! public void setUp() { createParser(html); *************** *** 61,67 **** assertEquals("LI tags found", 2, visitor.getTagCount(0)); } ! public void testMultipleTags() throws Exception { ! TagFindingVisitor visitor = new TagFindingVisitor( new String [] { --- 61,67 ---- assertEquals("LI tags found", 2, visitor.getTagCount(0)); } ! public void testMultipleTags() throws Exception { ! TagFindingVisitor visitor = new TagFindingVisitor( new String [] { *************** *** 77,81 **** public void testEndTags() throws Exception { ! TagFindingVisitor visitor = new TagFindingVisitor( new String [] { --- 77,81 ---- public void testEndTags() throws Exception { ! TagFindingVisitor visitor = new TagFindingVisitor( new String [] { Index: TextExtractingVisitorTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests/TextExtractingVisitorTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TextExtractingVisitorTest.java 8 Sep 2003 02:26:32 -0000 1.7 --- TextExtractingVisitorTest.java 10 Sep 2003 03:38:25 -0000 1.8 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 48,52 **** ); } ! public void testSimpleVisitWithRegisteredScanners() throws Exception { createParser("<HTML><HEAD><TITLE>Hello World</TITLE></HEAD></HTML>"); --- 48,52 ---- ); } ! public void testSimpleVisitWithRegisteredScanners() throws Exception { createParser("<HTML><HEAD><TITLE>Hello World</TITLE></HEAD></HTML>"); *************** *** 60,64 **** ); } ! public void testVisitHtmlWithSpecialChars() throws Exception { createParser("<BODY>Hello World </BODY>"); --- 60,64 ---- ); } ! public void testVisitHtmlWithSpecialChars() throws Exception { createParser("<BODY>Hello World </BODY>"); *************** *** 71,75 **** ); } ! public void testVisitHtmlWithPreTags() throws Exception { createParser( --- 71,75 ---- ); } ! public void testVisitHtmlWithPreTags() throws Exception { createParser( Index: UrlModifyingVisitorTest.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/visitorsTests/UrlModifyingVisitorTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** UrlModifyingVisitorTest.java 8 Sep 2003 02:26:32 -0000 1.7 --- UrlModifyingVisitorTest.java 10 Sep 2003 03:38:25 -0000 1.8 *************** *** 11,15 **** // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software --- 11,15 ---- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. ! // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software *************** *** 18,27 **** // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com --- 18,27 ---- // For any questions or suggestions, you can write to me at : // Email :so...@in... ! // ! // Postal Address : // Somik Raha // Extreme Programmer & Coach // Industrial Logic Corporation ! // 2583 Cedar Street, Berkeley, // CA 94708, USA // Website : http://www.industriallogic.com *************** *** 34,44 **** public class UrlModifyingVisitorTest extends ParserTestCase { ! private static final String HTML_WITH_LINK = "<HTML><BODY>" + "<A HREF=\"mylink.html\"><IMG SRC=\"mypic.jpg\">" + "</A><IMG SRC=\"mysecondimage.gif\">" + "</BODY></HTML>"; ! ! private static final String MODIFIED_HTML = "<HTML><BODY>" + "<A HREF=\"localhost://mylink.html\">" + --- 34,44 ---- public class UrlModifyingVisitorTest extends ParserTestCase { ! private static final String HTML_WITH_LINK = "<HTML><BODY>" + "<A HREF=\"mylink.html\"><IMG SRC=\"mypic.jpg\">" + "</A><IMG SRC=\"mysecondimage.gif\">" + "</BODY></HTML>"; ! ! private static final String MODIFIED_HTML = "<HTML><BODY>" + "<A HREF=\"localhost://mylink.html\">" + *************** *** 46,58 **** "<IMG SRC=\"localhost://mysecondimage.gif\">" + "</BODY></HTML>"; ! public UrlModifyingVisitorTest(String name) { super(name); } ! public void testUrlModificationWithVisitor() throws Exception { Parser parser = Parser.createParser(HTML_WITH_LINK); ! UrlModifyingVisitor visitor = ! new UrlModifyingVisitor(parser, "localhost://"); parser.visitAllNodesWith(visitor); assertStringEquals("Expected HTML", --- 46,58 ---- "<IMG SRC=\"localhost://mysecondimage.gif\">" + "</BODY></HTML>"; ! public UrlModifyingVisitorTest(String name) { super(name); } ! public void testUrlModificationWithVisitor() throws Exception { Parser parser = Parser.createParser(HTML_WITH_LINK); ! UrlModifyingVisitor visitor = ! new UrlModifyingVisitor(parser, "localhost://"); parser.visitAllNodesWith(visitor); assertStringEquals("Expected HTML", |