Java Testing Notes
  • Java Testing
  • Mockito
    • Mockito.mock()
    • Mockito.spy()
    • Mockito.verify()
    • Mockito.mockStatic()
    • ArgumentMatcher
    • ArgumentCaptor
  • PowerMockito
    • Why we need PowerMock?
    • PowerMockRunner
    • PrepareForTest
      • Understanding @PrepareForTest
    • SuppressStaticInitializationFor
    • PowerMockito.suppress()
    • PowerMockito.stub()
    • PowerMockito.replace()
    • PowerMockito.whenNew()
      • Limitation of PowerMockito.whenNew()
    • Whitebox.invokeMethod()
    • Whitebox.setInternalState()
    • Whitebox.getInternalState()
  • Tips
    • How to test ViewModel and LiveData
Powered by GitBook
On this page
  1. PowerMockito

PowerMockRunner

You must annotate each class you test with PowerMockRunner

@RunWith(PowerMockRunner.class)
public class ClassToTest {
}
PreviousWhy we need PowerMock?NextPrepareForTest

Last updated 2 years ago