1 27 package org.htmlparser.tests; 28 29 import junit.framework.TestSuite; 30 31 32 public class AssertXmlEqualsTest extends ParserTestCase { 33 34 static 35 { 36 System.setProperty ("org.htmlparser.tests.AssertXmlEqualsTest", "AssertXmlEqualsTest"); 37 } 38 39 public AssertXmlEqualsTest(String name) { 40 super(name); 41 } 42 43 public void testNestedTagWithText() throws Exception { 44 assertXmlEquals("nested with text","<hello> <hi>My name is Nothing</hi></hello>","<hello><hi>My name is Nothing</hi> </hello>"); 45 } 46 47 public void testThreeTagsDifferent() throws Exception { 48 assertXmlEquals("two tags different","<someTag></someTag><someOtherTag>","<someTag/><someOtherTag>"); 49 } 50 51 public void testOneTag() throws Exception { 52 assertXmlEquals("one tag","<someTag>","<someTag>"); 53 } 54 55 public void testTwoTags() throws Exception { 56 assertXmlEquals("two tags","<someTag></someTag>","<someTag></someTag>"); 57 } 58 59 public void testTwoTagsDifferent() throws Exception { 60 assertXmlEquals("two tags different","<someTag></someTag>","<someTag/>"); 61 } 62 63 public void testTwoTagsDifferent2() throws Exception { 64 assertXmlEquals("two tags different","<someTag/>","<someTag></someTag>"); 65 } 66 67 public void testTwoTagsWithSameAttributes() throws Exception { 68 assertXmlEquals("attributes","<tag name=\"John\" age=\"22\" sex=\"M\"/>","<tag sex=\"M\" name=\"John\" age=\"22\"/>"); 69 } 70 71 public void testTagWithText() throws Exception { 72 assertXmlEquals("text","<hello> My name is Nothing</hello>","<hello>My name is Nothing </hello>"); 73 } 74 75 public void testStringWithLineBreaks() throws Exception { 76 assertXmlEquals("string with line breaks","testing & refactoring","testing &\nrefactoring"); 77 } 78 79 public static TestSuite suite() { 80 TestSuite suite = new TestSuite("XML Tests"); 81 suite.addTestSuite(AssertXmlEqualsTest.class); 82 return (suite); 83 } 84 } 85 | Popular Tags |