Changeset 3974 for trunk/pfixcore/tests

Show
Ignore:
Timestamp:
01/08/09 18:47:31 (3 years ago)
Author:
mtld
Message:

Improved and documented unit and integration testing support

Location:
trunk/pfixcore/tests/junit
Files:
5 added
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/pfixcore/tests/junit/de/schlund/pfixcore/oxm/BooleanBeanTest.java

    r3570 r3974  
    2828import org.apache.log4j.Logger; 
    2929import org.apache.log4j.PatternLayout; 
     30import org.pustefixframework.test.XmlAssert; 
    3031import org.w3c.dom.Document; 
    3132 
     
    3536import de.schlund.pfixcore.oxm.impl.MarshallerImpl; 
    3637import de.schlund.pfixcore.oxm.impl.SerializerRegistry; 
    37 import de.schlund.pfixxml.util.XMLUtils; 
    3838 
    3939/** 
     
    6464        String expected = "<result admin=\"true\" deleted=\"false\"></result>"; 
    6565        Document expDoc = OxmTestHelper.createDocument(expected); 
    66         XMLUtils.assertEquals(expDoc, doc);         
     66        XmlAssert.assertEquals(expDoc, doc);         
    6767    } 
    6868} 
  • trunk/pfixcore/tests/junit/de/schlund/pfixcore/oxm/MapTest.java

    r3423 r3974  
    2828import org.apache.log4j.Logger; 
    2929import org.apache.log4j.PatternLayout; 
     30import org.pustefixframework.test.XmlAssert; 
    3031import org.w3c.dom.Document; 
    3132 
     
    3536import de.schlund.pfixcore.oxm.impl.MarshallerImpl; 
    3637import de.schlund.pfixcore.oxm.impl.SerializerRegistry; 
    37 import de.schlund.pfixxml.util.XMLUtils; 
    3838 
    3939/** 
     
    6666        String expected = "<result><annoMap><element><string>one</string><string>foo</string></element><element><string>two</string><string>bar</string></element></annoMap><myMap><entry><string>one</string><string>foo</string></entry><entry><string>two</string><string>bar</string></entry></myMap></result>"; 
    6767        Document expDoc = OxmTestHelper.createDocument(expected); 
    68         XMLUtils.assertEquals(expDoc, doc); 
     68        XmlAssert.assertEqualsUnordered(expDoc, doc); 
    6969    } 
    7070} 
  • trunk/pfixcore/tests/junit/de/schlund/pfixcore/oxm/SetTest.java

    r3967 r3974  
    2828import org.apache.log4j.Logger; 
    2929import org.apache.log4j.PatternLayout; 
     30import org.pustefixframework.test.XmlAssert; 
    3031import org.w3c.dom.Document; 
    3132 
     
    3536import de.schlund.pfixcore.oxm.impl.MarshallerImpl; 
    3637import de.schlund.pfixcore.oxm.impl.SerializerRegistry; 
    37 import de.schlund.pfixxml.util.XMLUtils; 
    3838 
    3939/** 
     
    6666        String expected = "<result><mySet><entry><string>foo</string></entry><entry><string>bar</string></entry></mySet><annoSet><element><string>foo</string></element><element><string>bar</string></element></annoSet></result>"; 
    6767        Document expDoc = OxmTestHelper.createDocument(expected); 
    68         XMLUtils.assertEquals(expDoc, doc); 
     68        XmlAssert.assertEquals(expDoc, doc); 
    6969    } 
    7070} 
  • trunk/pfixcore/tests/junit/de/schlund/pfixcore/oxm/Test.java

    r3402 r3974  
    3939import org.apache.log4j.Logger; 
    4040import org.apache.log4j.PatternLayout; 
     41import org.pustefixframework.test.XmlAssert; 
    4142import org.w3c.dom.Document; 
    4243 
     
    8081        String expected = "<result prio=\"HIGH\" text=\"abc\"><day name=\"FRIDAY\" workingHours=\"6\"/></result>"; 
    8182        Document expDoc = OxmTestHelper.createDocument(expected); 
    82         XMLUtils.assertEquals(expDoc, doc); 
     83        XmlAssert.assertEquals(expDoc, doc); 
    8384 
    8485        // List with enums 
     
    9394        expected = "<result><weekDay workingHours=\"8\" name=\"MONDAY\"/><priority>LOW</priority></result>"; 
    9495        expDoc = OxmTestHelper.createDocument(expected); 
    95         XMLUtils.assertEquals(expDoc, doc); 
     96        XmlAssert.assertEquals(expDoc, doc); 
    9697    } 
    9798 
     
    145146        Result res = new DOMResult(doc); 
    146147        m.marshal(bean, res); 
    147         XMLUtils.assertEquals(expDoc, doc); 
     148        XmlAssert.assertEqualsUnordered(expDoc, doc); 
    148149    } 
    149150 
     
    160161        Result res = new DOMResult(doc); 
    161162        m.marshal(fBean, res); 
    162         XMLUtils.assertEquals(expDoc, doc); 
     163        XmlAssert.assertEquals(expDoc, doc); 
    163164    } 
    164165 
     
    177178        Document expDoc = OxmTestHelper.createDocument(expected); 
    178179         
    179         XMLUtils.assertEquals(expDoc, doc); 
     180        XmlAssert.assertEqualsUnordered(expDoc, doc); 
    180181    } 
    181182     
  • trunk/pfixcore/tests/junit/de/schlund/pfixxml/targets/TargetGeneratorTest.java

    r3531 r3974  
    1515 
    1616import de.schlund.pfixxml.XMLException; 
     17import de.schlund.pfixxml.config.GlobalConfig; 
    1718import de.schlund.pfixxml.config.GlobalConfigurator; 
    1819import de.schlund.pfixxml.resources.FileResource; 
     
    2526 
    2627    static { 
    27         GlobalConfigurator.setDocroot(DOCROOT.getAbsolutePath()); 
     28        if(GlobalConfig.getDocroot()==null) GlobalConfigurator.setDocroot(DOCROOT.getAbsolutePath()); 
    2829    } 
    2930 
     31    @Override 
     32    protected void tearDown() throws Exception { 
     33        TargetGeneratorFactory.getInstance().reset(); 
     34    } 
     35     
    3036    public void testEmpty() throws Exception { 
    3137 
  • trunk/pfixcore/tests/junit/de/schlund/pfixxml/util/XmlTest.java

    r2956 r3974  
    126126     
    127127    public void testSerializeDecl() throws Exception { 
    128         assertEquals("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><a/>", serialize("<a/>", false, true)); 
     128        assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><a/>", serialize("<a/>", false, true)); 
    129129    } 
    130130 
     
    160160        dest= new ByteArrayOutputStream(); 
    161161        Xml.serialize(parse(STR), dest, false, true); 
    162         checkEquals(("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + STR).getBytes("ISO-8859-1"), dest.toByteArray()); 
     162        checkEquals(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + STR).getBytes("UTF-8"), dest.toByteArray()); 
    163163    } 
    164164 
  • trunk/pfixcore/tests/junit/org/pustefixframework/config/generic/PropertyFileReaderTest.java

    r3804 r3974  
    44 
    55import java.io.File; 
     6import java.io.FileInputStream; 
    67import java.io.InputStream; 
    78import java.util.Properties; 
     
    3940    @Test 
    4041    public void test() throws Exception { 
    41          
    4242        InputStream in = getClass().getResourceAsStream("properties.xml"); 
     43        if(in==null) in = new FileInputStream(new File("tests/junit/org/pustefixframework/config/generic/properties.xml")); 
    4344        Properties props = new Properties(); 
    4445        PropertyFileReader.read(in, props);