Package org.powermock.modules.testng
Class PowerMockTestCase
- java.lang.Object
-
- org.powermock.modules.testng.PowerMockTestCase
-
public class PowerMockTestCase extends java.lang.ObjectA PowerMock base class that may be used as a base class for all TestNG test cases that uses PowerMock.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ObjectannotationEnablerprivate java.lang.ClassLoaderpreviousCl
-
Constructor Summary
Constructors Constructor Description PowerMockTestCase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterPowerMockTestClass()protected voidafterPowerMockTestMethod()Must be executed after each test method.protected voidbeforePowerMockTestClass()protected voidbeforePowerMockTestMethod()Must be executed before each test method.private voidclearMockFields()org.testng.ITestObjectFactorycreate(org.testng.ITestContext context)private voidinjectMocks()private booleanisLoadedByPowerMockClassloader()
-
-
-
Method Detail
-
beforePowerMockTestClass
@BeforeClass protected void beforePowerMockTestClass() throws java.lang.Exception- Throws:
java.lang.Exception
-
afterPowerMockTestClass
@AfterClass protected void afterPowerMockTestClass() throws java.lang.Exception- Throws:
java.lang.Exception
-
beforePowerMockTestMethod
@BeforeMethod protected void beforePowerMockTestMethod() throws java.lang.ExceptionMust be executed before each test method. This method does the following:- Injects all mock fields (if they haven't been injected already)
- Throws:
java.lang.Exception- If something unexpected goes wrong.
-
afterPowerMockTestMethod
@AfterMethod protected void afterPowerMockTestMethod() throws java.lang.ExceptionMust 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:
java.lang.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
private void clearMockFields() throws java.lang.Exception- Throws:
java.lang.Exception
-
injectMocks
private void injectMocks() throws java.lang.Exception- Throws:
java.lang.Exception
-
isLoadedByPowerMockClassloader
private boolean isLoadedByPowerMockClassloader()
-
-