To mock static methods
Check this class which will be a good example (RadiusAuthSessionStateTest.java)
You need to write these two at top of the class
@RunWith(value = PowerMockRunner.class)
@PrepareForTest(RadiusClientImpl.class)
In before you need to mention
PowerMockito.mockStatic(RadiusClientImpl.class);
PowerMockito.mockStatic(RadiusServerServicesManagerImpl.class);
which class you need to mock….Then as usual use when
Check this class which will be a good example (RadiusAuthSessionStateTest.java)
You need to write these two at top of the class
@RunWith(value = PowerMockRunner.class)
@PrepareForTest(RadiusClientImpl.class)
In before you need to mention
PowerMockito.mockStatic(RadiusClientImpl.class);
PowerMockito.mockStatic(RadiusServerServicesManagerImpl.class);
which class you need to mock….Then as usual use when
No comments:
Post a Comment