Bug#1022938: ITP: junit-clptr -- ClassLoader per Test runner for JUnit 4.12+ based on myfaces-test "TestPerClassLoaderRunner".
Package: wnpp
Severity: wishlist
Owner: sunmin <summer-dev@outlook.com>
X-Debbugs-Cc: debian-devel@lists.debian.org,debian-java@lists.debian.org
* Package name : junit-clptr
Version : 1.2.2
Upstream Author : Pino Silvaggio
* URL : https://github.com/bitstrings/junit-clptr
* License : Apache License 2.0
Programming Lang: Java
Description : ClassLoader per Test runner for JUnit 4.12+ based on myfaces-test "TestPerClassLoaderRunner".
ClassLoader per Test runner for JUnit 4.12+ based on myfaces-test "TestPerClassLoaderRunner".
Each test method will run with its very own ClassLoader which can be very useful for a variety of use cases (testing classes with static fields for example).
Maven dependency
<dependency>
<groupId>org.bitstrings.test</groupId>
<artifactId>junit-clptr</artifactId>
<version>1.2.2</version>
</dependency>
Usage
import org.bitstrings.test.junit.runner.ClassLoaderPerTestRunner;
@RunWith( ClassLoaderPerTestRunner.class )
public class Test
{
...
}
Exclude classes using @ClptrExclude annotation
You can exclude a package or a specific class.
@RunWith( ClassLoaderPerTestRunner.class )
@ClptrExclude( "mockit." )
public class Test
{
...
}
@RunWith( ClassLoaderPerTestRunner.class )
@ClptrExclude( { "mockit.", "org.somethings.MyClass" } )
public class Test
{
...
}
You may use @ClptrExclude on classes and methods.
Globally exclude classes from isolation using file
Use the default file clptr-excludes.properties to add excluded packages or classes from isolation.
The file should be on the classpath.
You can override the excludes file location using the system property org.bitstrings.test.junit.runner.TestClassLoader.excludes.
org.bitstrings.test.junit.runner.TestClassLoader.excludes=com/company/res/clptr-excludes.properties
The file is simply a list of packages and classes (see @ClptrExclude):
jmockit.
org.apache.
com.company.test.TestClass
What's new
@ClptrExclude annotation;
Fix for "@Rule" annotated field and method;
Threadsafe (Hopeful...);
Support excludes.
This package is a new dependency of the latest upstream libcommons-validator-java v1.7 (https://github.com/apache/commons-validator/releases/tag/VALIDATOR_1_7)
Reply to: