1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.oxm.xstream;
18
19 import com.thoughtworks.xstream.io.StreamException;
20 import com.thoughtworks.xstream.mapper.CannotResolveClassException;
21
22 import junit.framework.TestCase;
23
24 public class XStreamUtilsTest extends TestCase {
25
26 public void testConvertStreamException() {
27 assertTrue("Invalid exception conversion", XStreamUtils.convertXStreamException(
28 new StreamException(new Exception()), true) instanceof XStreamMarshallingFailureException);
29 assertTrue("Invalid exception conversion", XStreamUtils.convertXStreamException(
30 new StreamException(new Exception()), false) instanceof XStreamUnmarshallingFailureException);
31 }
32
33 public void testConvertCannotResolveClassException() {
34 assertTrue("Invalid exception conversion", XStreamUtils.convertXStreamException(
35 new CannotResolveClassException(""), true) instanceof XStreamMarshallingFailureException);
36 assertTrue("Invalid exception conversion", XStreamUtils.convertXStreamException(
37 new CannotResolveClassException(""), false) instanceof XStreamUnmarshallingFailureException);
38 }
39 }