01: /*
02: * Copyright (C) 2005 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 07. March 2005 by Joe Walnes
11: */
12: package com.thoughtworks.acceptance;
13:
14: public class ClassLoaderTest extends AbstractAcceptanceTest {
15:
16: private String classLoaderCall;
17:
18: public void testAllowsClassLoaderToBeOverriden() {
19: xstream.setClassLoader(new MockClassLoader());
20: assertEquals("hello", xstream
21: .fromXML("<java.BANG.String>hello</java.BANG.String>"));
22: assertEquals("java.BANG.String", classLoaderCall);
23: }
24:
25: private class MockClassLoader extends ClassLoader {
26: public Class loadClass(String name) {
27: classLoaderCall = name;
28: return String.class;
29: }
30: }
31: }
|