TestCaseClassLoader
Keywords: junit.runner.TestCaseClassLoader class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## junit.runner
Class TestCaseClassLoader

    java.lang.Object
      java.lang.ClassLoader
          junit.runner.TestCaseClassLoader

    public class TestCaseClassLoader

extends java.lang.ClassLoader

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
`TestCaseClassLoader()` Constructs a TestCaseLoader.
`TestCaseClassLoader(java.lang.String classPath)` Constructs a TestCaseLoader.

Method Summary
`java.net.URL` | `getResource(java.lang.String name)`
`java.io.InputStream` | `getResourceAsStream(java.lang.String name)`
`boolean` | `isExcluded(java.lang.String name)`
`java.lang.Class` | `loadClass(java.lang.String name, boolean resolve)`

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TestCaseClassLoader

    public TestCaseClassLoader()

  Constructs a TestCaseLoader. It scans the class path and the excluded package paths

### TestCaseClassLoader

    public TestCaseClassLoader(java.lang.String classPath)

  Constructs a TestCaseLoader. It scans the class path and the excluded package paths

Method Detail

### getResource

    public java.net.URL getResource(java.lang.String name)

  Overrides:
    `getResource` in class `java.lang.ClassLoader`

### getResourceAsStream

    public java.io.InputStream getResourceAsStream(java.lang.String name)

  Overrides:
    `getResourceAsStream` in class `java.lang.ClassLoader`

### isExcluded

    public boolean isExcluded(java.lang.String name)

### loadClass

    public java.lang.Class loadClass(java.lang.String name,
                                     boolean resolve)
                              throws java.lang.ClassNotFoundException

  Overrides:
    `loadClass` in class `java.lang.ClassLoader`
  Throws:
    `java.lang.ClassNotFoundException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD