piyclassloadertest.java
来自「PIY(Program It Yourself)是一个基于Java的应用程序开发」· Java 代码 · 共 40 行
JAVA
40 行
package piytest;
import piy.PIYClassLoader;
import piy.UserComponent;
import java.io.*;
import junit.framework.*;
/**
* Tests the functionality of the PIYClassLoader. The tests make use of the dummy test set
* (the classes as presented in the "dummy" directory and its subdirectories).
* @author David Vivash
* @version 1.0, 22/11/00
*/
public class PIYClassLoaderTest extends TestCase
{
public PIYClassLoaderTest(String name) {
super(name);
}
public static Test suite() {
return new TestSuite(PIYClassLoaderTest.class);
}
public void testDirectoryRecursion() {
try{
//there should be five valid classes when we recurse
assert(PIYClassLoader.getClasses(new File("piytest\\dummy\\"), "piytest.", UserComponent.class, java.awt.Component.class, true).length == 5);
//there should only be 3 valid classes if we don't recurse
assert(PIYClassLoader.getClasses(new File("piytest\\dummy\\"), "piytest.", UserComponent.class, java.awt.Component.class, false).length == 3);
} catch (FileNotFoundException e) {
fail("The file is there - but we've got a file not found exception!");
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?