import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.BDDMockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest(MyStatic.class)
...
@Test
public void someTest() {
//given
PowerMockito.mockStatic(MyStatic.class);
BDDMockito.given(MyStatic.someStaticMethod()).willReturn(...);
//when
...
//then
PowerMockito.verifyStatic();
MyStatic.someStaticMethod();
assertThat(//your further asserts....
Keine Kommentare:
Kommentar veröffentlichen