Package org.powermock.modules.testng
Class PowerMockTestCase
java.lang.Object
org.powermock.modules.testng.PowerMockTestCase
A PowerMock base class that may be used as a base class for all TestNG
test cases that uses PowerMock.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
Must be executed after each test method.protected void
protected void
Must be executed before each test method.private void
org.testng.ITestObjectFactory
create
(org.testng.ITestContext context) private void
private boolean
-
Field Details
-
annotationEnabler
-
previousCl
-
-
Constructor Details
-
PowerMockTestCase
public PowerMockTestCase()
-
-
Method Details
-
beforePowerMockTestClass
- Throws:
Exception
-
afterPowerMockTestClass
- Throws:
Exception
-
beforePowerMockTestMethod
Must be executed before each test method. This method does the following:- Injects all mock fields (if they haven't been injected already)
- Throws:
Exception
- If something unexpected goes wrong.
-
afterPowerMockTestMethod
Must be executed after each test method. This method does the following:- Clear all injection fields (those annotated with a Mock annotation)
- Clears the PowerMock MockRepository
- Throws:
Exception
- if something unexpected goes wrong.
-
create
public org.testng.ITestObjectFactory create(org.testng.ITestContext context) - Parameters:
context
- the test context.- Returns:
- The PowerMock object factory.
-
clearMockFields
- Throws:
Exception
-
injectMocks
- Throws:
Exception
-
isLoadedByPowerMockClassloader
private boolean isLoadedByPowerMockClassloader()
-