01: package com.ecyrd.jspwiki.util;
02:
03: import junit.framework.*;
04:
05: public class ClassUtilTest extends TestCase {
06: public ClassUtilTest(String s) {
07: super (s);
08: }
09:
10: /**
11: * Tries to find an existing class.
12: */
13: public void testFindClass() throws Exception {
14: Class foo = ClassUtil
15: .findClass("com.ecyrd.jspwiki", "WikiPage");
16:
17: assertEquals(foo.getName(), "com.ecyrd.jspwiki.WikiPage");
18: }
19:
20: /**
21: * Non-existant classes should throw ClassNotFoundEx.
22: */
23: public void testFindClassNoClass() throws Exception {
24: try {
25: Class foo = ClassUtil.findClass("com.ecyrd.jspwiki",
26: "MubbleBubble");
27: fail("Found class:" + foo);
28: } catch (ClassNotFoundException e) {
29: // Expected
30: }
31: }
32:
33: public static Test suite() {
34: return new TestSuite(ClassUtilTest.class);
35: }
36: }
|