📄 piyclassloadertest.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -