1 20 package org.apache.cactus.internal.server.runner; 21 22 import junit.framework.TestCase; 23 import junit.framework.TestResult; 24 25 30 public final class TestXMLFormatter extends TestCase 31 { 32 35 private XMLFormatter formatter; 36 37 40 private TestResult testResult; 41 42 45 public void setUp() 46 { 47 formatter = new XMLFormatter(); 48 testResult = new TestResult(); 49 } 50 51 55 public void testToXmlEmptyWithDefaultEncoding() 56 { 57 String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" 58 + "<testsuites><testsuite name=\"null\" tests=\"0\" failures=\"0\"" 59 + " errors=\"0\" time=\"0\"></testsuite></testsuites>"; 60 61 String result = formatter.toXML(testResult); 62 assertEquals(expected, result); 63 } 64 65 69 public void testToXmlEmptyWithCustomEncoding() 70 { 71 String expected = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" 72 + "<testsuites><testsuite name=\"null\" tests=\"0\" failures=\"0\"" 73 + " errors=\"0\" time=\"0\"></testsuite></testsuites>"; 74 75 formatter.setEncoding("ISO-8859-1"); 76 String result = formatter.toXML(testResult); 77 assertEquals(expected, result); 78 } 79 } 80 | Popular Tags |