Package junit.runner
Class TestCaseClassLoader
java.lang.Object
java.lang.ClassLoader
junit.runner.TestCaseClassLoader
A custom class loader which enables the reloading
of classes for each test run. The class loader
can be configured with a list of package paths that
should be excluded from loading. The loading
of these packages is delegated to the system class
loader. They will be shared across test runs.
The list of excluded package paths is specified in a properties file "excluded.properties" that is located in the same place as the TestCaseClassLoader class.
Known limitation: the TestCaseClassLoader cannot load classes from jar files.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a TestCaseLoader.TestCaseClassLoader
(String classPath) Constructs a TestCaseLoader. -
Method Summary
Modifier and TypeMethodDescriptiongetResource
(String name) getResourceAsStream
(String name) boolean
isExcluded
(String name) Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
TestCaseClassLoader
public TestCaseClassLoader()Constructs a TestCaseLoader. It scans the class path and the excluded package paths -
TestCaseClassLoader
Constructs a TestCaseLoader. It scans the class path and the excluded package paths
-
-
Method Details
-
getResource
- Overrides:
getResource
in classClassLoader
-
getResourceAsStream
- Overrides:
getResourceAsStream
in classClassLoader
-
isExcluded
-
loadClass
- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-