01: /*
02: * Copyright (C) 2004 Joe Walnes.
03: * Copyright (C) 2006, 2007 XStream Committers.
04: * All rights reserved.
05: *
06: * The software in this package is published under the terms of the BSD
07: * style license a copy of which has been included with this distribution in
08: * the LICENSE.txt file.
09: *
10: * Created on 29. May 2004 by Joe Walnes
11: */
12: package com.thoughtworks.xstream.converters.extended;
13:
14: import com.thoughtworks.acceptance.AbstractAcceptanceTest;
15:
16: /**
17: * @author <a href="mailto:boxley@thoughtworks.com">B. K. Oxley (binkley)</a>
18: * @author Joe Walnes
19: */
20: public class StackTraceElementConverterTest extends
21: AbstractAcceptanceTest {
22:
23: private StackTraceElementFactory factory = new StackTraceElementFactory();
24:
25: public void testSerializesStackTraceElement() {
26: StackTraceElement trace = factory.unknownSourceElement(
27: "com.blah.SomeClass", "someMethod");
28: String expectedXml = "<trace>com.blah.SomeClass.someMethod(Unknown Source)</trace>";
29: assertBothWays(trace, expectedXml);
30: }
31:
32: public void testIncludesDebugInformation() {
33: StackTraceElement trace = factory.element("com.blah.SomeClass",
34: "someMethod", "SomeClass.java", 22);
35: String expectedXml = "<trace>com.blah.SomeClass.someMethod(SomeClass.java:22)</trace>";
36: assertBothWays(trace, expectedXml);
37: }
38:
39: public void testIncludesPartialDebugInformation() {
40: StackTraceElement trace = factory.element("com.blah.SomeClass",
41: "someMethod", "SomeClass.java");
42: String expectedXml = "<trace>com.blah.SomeClass.someMethod(SomeClass.java)</trace>";
43: assertBothWays(trace, expectedXml);
44: }
45:
46: public void testIncludesNativeMethods() {
47: StackTraceElement trace = factory.nativeMethodElement(
48: "com.blah.SomeClass", "someMethod");
49: String expectedXml = "<trace>com.blah.SomeClass.someMethod(Native Method)</trace>";
50: assertBothWays(trace, expectedXml);
51: }
52:
53: public void testSupportsInnerClasses() {
54: StackTraceElement trace = factory.unknownSourceElement(
55: "com.blah.SomeClass$Inner$2", "someMethod");
56: String expectedXml = "<trace>com.blah.SomeClass$Inner$2.someMethod(Unknown Source)</trace>";
57: assertBothWays(trace, expectedXml);
58: }
59:
60: }
|