Package org.apache.pulsar.tests
Class MockitoCleanupListener
- java.lang.Object
-
- org.apache.pulsar.tests.MockitoCleanupListener
-
- All Implemented Interfaces:
org.testng.IClassListener,org.testng.ITestListener,org.testng.ITestNGListener
public class MockitoCleanupListener extends java.lang.ObjectCleanup Mockito's Thread Local state that leaks memory Mockito.reset method should be called at the end of a test in the same thread where the methods were mocked/stubbed. There are some tests which mock methods in the ForkJoinPool thread and these leak memory. This listener doesn't support parallel execution at TestNG level. This is not thread safe. Separate forkstestForkCount > 1controlled with Maven Surefire is the recommended solution for parallel test execution and that is fine.
-
-
Constructor Summary
Constructors Constructor Description MockitoCleanupListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonBeforeClass(org.testng.ITestClass testClass)protected voidonBetweenTestClasses(java.lang.Class<?> endedTestClass, java.lang.Class<?> startedTestClass)Call back hook for adding logic when test execution moves from test class to another.voidonFinish(org.testng.ITestContext context)
-
-
-
Method Detail
-
onBetweenTestClasses
protected void onBetweenTestClasses(java.lang.Class<?> endedTestClass, java.lang.Class<?> startedTestClass)Call back hook for adding logic when test execution moves from test class to another.- Parameters:
endedTestClass- the test class which has finished execution. null if the started test class is the firststartedTestClass- the test class which has started execution. null if the ended test class is the last
-
onBeforeClass
public void onBeforeClass(org.testng.ITestClass testClass)
- Specified by:
onBeforeClassin interfaceorg.testng.IClassListener
-
onFinish
public void onFinish(org.testng.ITestContext context)
- Specified by:
onFinishin interfaceorg.testng.ITestListener
-
-