KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > clazzy > FileSystemClassLoaderTest


1 package org.sapia.clazzy;
2 import java.io.File JavaDoc;
3
4 import org.sapia.clazzy.FileSystemClassLoader;
5 import org.sapia.clazzy.test.Printable;
6
7 import junit.framework.TestCase;
8
9
10 /**
11  * @author Yanick Duchesne
12  *
13  * <dl>
14  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2004 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
15  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
16  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
17  * </dl>
18  */

19 public class FileSystemClassLoaderTest extends TestCase{
20   
21   public FileSystemClassLoaderTest(String JavaDoc name){
22     super(name);
23   }
24   
25   public void testLoadClass() throws Exception JavaDoc{
26     FileSystemClassLoader loader = new FileSystemClassLoader(new File JavaDoc("etc/test/classes"));
27     Printable p = (Printable)loader.loadClass("test.FileSystemClass").newInstance();
28     super.assertTrue(p.getClass().getPackage() != null);
29     try{
30       loader.loadClass("test.None");
31       fail("ClassNotFoundException should have been thrown");
32     }catch(ClassNotFoundException JavaDoc e){
33       //ok
34
}
35   }
36
37 }
38
Popular Tags