Package se.jiderhamn.classloader.leak
Class JUnitClassloaderRunner
- java.lang.Object
-
- org.junit.runner.Runner
-
- org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
-
- org.junit.runners.BlockJUnit4ClassRunner
-
- se.jiderhamn.classloader.leak.JUnitClassloaderRunner
-
- All Implemented Interfaces:
org.junit.runner.Describable,org.junit.runner.manipulation.Filterable,org.junit.runner.manipulation.Orderable,org.junit.runner.manipulation.Sortable
public class JUnitClassloaderRunner extends org.junit.runners.BlockJUnit4ClassRunner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classJUnitClassloaderRunner.SeparateClassLoaderInvokeMethod
-
Field Summary
Fields Modifier and Type Field Description private static intHALT_TIME_SNumber of seconds to halt to allow for heap dump aquirement, if that option is enabled
-
Constructor Summary
Constructors Constructor Description JUnitClassloaderRunner(java.lang.Class<?> klass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private <T> T[]appendArrays(T[] arr1, T[] arr2)Append two arraysprivate voiddumpHeap(java.lang.String testName)Create heap dump in file with same name as the teststatic voidforceGc()Make sure Garbage Collection has been runstatic voidforceGc(int n)Make sure Garbage Collection has been run N no of timesprivate java.io.FilegetSurefireReportsDirectory()Try to find "target/surefire-reports" directory, assuming this is a Maven build.private static java.io.FilegetSurefireReportsDirectory(java.lang.Class<?> clazz)Try to find "target/surefire-reports" directory, assuming this is a Maven build.protected org.junit.runners.model.StatementmethodInvoker(org.junit.runners.model.FrameworkMethod method, java.lang.Object test)private static voidwaitForHeapDump()-
Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, createTest, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, possiblyExpectingExceptions, rules, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
-
Methods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classBlock, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation
-
-
-
-
Field Detail
-
HALT_TIME_S
private static final int HALT_TIME_S
Number of seconds to halt to allow for heap dump aquirement, if that option is enabled- See Also:
- Constant Field Values
-
-
Method Detail
-
methodInvoker
protected org.junit.runners.model.Statement methodInvoker(org.junit.runners.model.FrameworkMethod method, java.lang.Object test)- Overrides:
methodInvokerin classorg.junit.runners.BlockJUnit4ClassRunner
-
forceGc
public static void forceGc(int n)
Make sure Garbage Collection has been run N no of times
-
forceGc
public static void forceGc()
Make sure Garbage Collection has been run
-
waitForHeapDump
private static void waitForHeapDump() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
dumpHeap
private void dumpHeap(java.lang.String testName)
Create heap dump in file with same name as the test
-
getSurefireReportsDirectory
private java.io.File getSurefireReportsDirectory()
Try to find "target/surefire-reports" directory, assuming this is a Maven build. Returns null it not found, not writable or other error.
-
getSurefireReportsDirectory
private static java.io.File getSurefireReportsDirectory(java.lang.Class<?> clazz)
Try to find "target/surefire-reports" directory, assuming this is a Maven build. Returns null it not found, not writable or other error.
-
appendArrays
private <T> T[] appendArrays(T[] arr1, T[] arr2)Append two arrays
-
-