1 20 package org.apache.cactus.internal; 21 22 import junit.framework.TestCase; 23 24 29 public class TestWebTestResult extends TestCase 30 { 31 35 public void testToXmlNoException() 36 { 37 WebTestResult result = new WebTestResult(); 38 39 assertEquals("<webresult></webresult>", result.toXml()); 40 } 41 42 46 public void testToXmlWithException() 47 { 48 String expectedStart = "<webresult><exception classname=\"" 49 + "java.lang.Exception\"><message><![CDATA[test exception]]>" 50 + "</message><stacktrace><![CDATA["; 51 String expectedEnd = "]]></stacktrace></exception></webresult>"; 52 53 Exception e = new Exception ("test exception"); 54 WebTestResult result = new WebTestResult(e); 55 56 assertTrue("Should have started with [" + expectedStart + "]", 57 result.toXml().startsWith(expectedStart)); 58 assertTrue("Should have ended with [" + expectedEnd + "]", 59 result.toXml().endsWith(expectedEnd)); 60 } 61 } 62 | Popular Tags |