Bael 4461 2 (#4444)
* [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * [BAEL-4462] - Fixed integration tests * Fix verification times
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
096826cc07
commit
a54c9e0c9e
+5
-3
@@ -7,6 +7,8 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.powermock.api.mockito.PowerMockito.*;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@@ -23,7 +25,7 @@ public class PowerMockitoIntegrationTest {
|
||||
|
||||
when(collaborator.helloMethod()).thenReturn("Hello Baeldung!");
|
||||
String welcome = collaborator.helloMethod();
|
||||
Mockito.verify(collaborator).helloMethod();
|
||||
verify(collaborator).helloMethod();
|
||||
assertEquals("Hello Baeldung!", welcome);
|
||||
}
|
||||
|
||||
@@ -42,7 +44,7 @@ public class PowerMockitoIntegrationTest {
|
||||
assertEquals("Hello Baeldung!", firstWelcome);
|
||||
assertEquals("Hello Baeldung!", secondWelcome);
|
||||
|
||||
verifyStatic(Mockito.times(2));
|
||||
verifyStatic(times(2));
|
||||
CollaboratorWithStaticMethods.firstMethod(Mockito.anyString());
|
||||
|
||||
verifyStatic(Mockito.never());
|
||||
@@ -67,7 +69,7 @@ public class PowerMockitoIntegrationTest {
|
||||
|
||||
when(mock.finalMethod()).thenReturn("I am a final mock method.");
|
||||
returnValue = mock.finalMethod();
|
||||
Mockito.verify(mock).finalMethod();
|
||||
verify(mock,times(3)).finalMethod();
|
||||
assertEquals("I am a final mock method.", returnValue);
|
||||
|
||||
when(mock, "privateMethod").thenReturn("I am a private mock method.");
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public class MockitoMockIntegrationTest {
|
||||
}
|
||||
|
||||
@Rule
|
||||
private ExpectedException thrown = ExpectedException.none();
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void whenUsingSimpleMock_thenCorrect() {
|
||||
|
||||
Reference in New Issue
Block a user