1 package com.thoughtworks.xstream.converters.extended; 2 3 import com.thoughtworks.xstream.XStream; 4 import com.thoughtworks.xstream.converters.MarshallingContext; 5 import com.thoughtworks.xstream.io.HierarchicalStreamWriter; 6 import com.thoughtworks.acceptance.AbstractAcceptanceTest; 7 import junit.framework.TestCase; 8 import com.thoughtworks.xstream.converters.extended.StackTraceElementConverter; 9 10 14 public class StackTraceElementConverterTest extends AbstractAcceptanceTest { 15 16 private StackTraceElementFactory factory = new StackTraceElementFactory(); 17 18 public void testSerializesStackTraceElement() { 19 StackTraceElement trace = factory.unknownSourceElement("com.blah.SomeClass", "someMethod"); 20 String expectedXml = "<trace>com.blah.SomeClass.someMethod(Unknown Source)</trace>"; 21 assertBothWays(trace, expectedXml); 22 } 23 24 public void testIncludesDebugInformation() { 25 StackTraceElement trace = factory.element("com.blah.SomeClass", "someMethod", "SomeClass.java", 22); 26 String expectedXml = "<trace>com.blah.SomeClass.someMethod(SomeClass.java:22)</trace>"; 27 assertBothWays(trace, expectedXml); 28 } 29 30 public void testIncludesPartialDebugInformation() { 31 StackTraceElement trace = factory.element("com.blah.SomeClass", "someMethod", "SomeClass.java"); 32 String expectedXml = "<trace>com.blah.SomeClass.someMethod(SomeClass.java)</trace>"; 33 assertBothWays(trace, expectedXml); 34 } 35 36 public void testIncludesNativeMethods() { 37 StackTraceElement trace = factory.nativeMethodElement("com.blah.SomeClass", "someMethod"); 38 String expectedXml = "<trace>com.blah.SomeClass.someMethod(Native Method)</trace>"; 39 assertBothWays(trace, expectedXml); 40 } 41 42 public void testSupportsInnerClasses() { 43 StackTraceElement trace = factory.unknownSourceElement("com.blah.SomeClass$Inner$2", "someMethod"); 44 String expectedXml = "<trace>com.blah.SomeClass$Inner$2.someMethod(Unknown Source)</trace>"; 45 assertBothWays(trace, expectedXml); 46 } 47 48 } 49 | Popular Tags |