⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
junit.runner

Class TestCaseClassLoader

ClassLoader
|
+--junit.runner.TestCaseClassLoader


public class TestCaseClassLoader
extends 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(String classPath)

Constructs a TestCaseLoader.

Method Summary

URL

getResource(String name)

InputStream

getResourceAsStream(String name)

boolean

isExcluded(String name)

synchronized Class

loadClass(String name, boolean resolve)

Constructor Details

TestCaseClassLoader

public TestCaseClassLoader()

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


TestCaseClassLoader

public TestCaseClassLoader(String classPath)

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

Parameters:
classPath

Method Details

getResource

public URL getResource(String name)

Parameters:
name

getResourceAsStream

public InputStream getResourceAsStream(String name)

Parameters:
name

isExcluded

public boolean isExcluded(String name)

Parameters:
name

loadClass

public synchronized Class loadClass(String name, boolean resolve)

Parameters:
name
resolve