KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtworks > acceptance > ClassLoaderTest


1 package com.thoughtworks.acceptance;
2
3 public class ClassLoaderTest extends AbstractAcceptanceTest {
4
5     private String JavaDoc classLoaderCall;
6
7     public void testAllowsClassLoaderToBeOverriden() {
8         xstream.setClassLoader(new MockClassLoader());
9         assertEquals("hello", xstream.fromXML("<java.BANG.String>hello</java.BANG.String>"));
10         assertEquals("java.BANG.String", classLoaderCall);
11     }
12
13     private class MockClassLoader extends ClassLoader JavaDoc {
14         public Class JavaDoc loadClass(String JavaDoc name) throws ClassNotFoundException JavaDoc {
15             classLoaderCall = name;
16             return String JavaDoc.class;
17         }
18     }
19 }
20
Popular Tags