JAVA-3591: updating mockito-core to 4.1.0

This commit is contained in:
chaos2418
2021-12-16 09:17:01 +05:30
parent b6af089858
commit 000dcdf966
34 changed files with 48 additions and 135 deletions
@@ -7,8 +7,6 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
public class MockitoConfigExamplesIntegrationTest {
@@ -7,8 +7,6 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
import com.baeldung.mockito.MyList;
@@ -4,7 +4,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.MockSettings;
import org.mockito.exceptions.verification.TooLittleActualInvocations;
import org.mockito.exceptions.verification.TooFewActualInvocations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -42,7 +42,7 @@ public class MockitoMockIntegrationTest {
when(listMock.add(anyString())).thenReturn(false);
listMock.add(randomAlphabetic(6));
thrown.expect(TooLittleActualInvocations.class);
thrown.expect(TooFewActualInvocations.class);
thrown.expectMessage(containsString("myMock.add"));
verify(listMock, times(2)).add(anyString());
@@ -2,8 +2,6 @@ package com.baeldung.mockito;
import static org.mockito.Mockito.*;
import com.baeldung.mockito.MyList;
import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.containsString;
@@ -13,7 +11,7 @@ import org.junit.Test;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.mockito.MockSettings;
import org.mockito.exceptions.verification.TooLittleActualInvocations;
import org.mockito.exceptions.verification.TooFewActualInvocations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -45,7 +43,7 @@ public class MockitoMockUnitTest {
when(listMock.add(anyString())).thenReturn(false);
listMock.add(randomAlphabetic(6));
thrown.expect(TooLittleActualInvocations.class);
thrown.expect(TooFewActualInvocations.class);
thrown.expectMessage(containsString("myMock.add"));
verify(listMock, times(2)).add(anyString());
@@ -11,7 +11,6 @@ import java.util.List;
import static org.hamcrest.Matchers.hasItem;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
public class MockitoVerifyExamplesIntegrationTest {
@@ -35,7 +34,7 @@ public class MockitoVerifyExamplesIntegrationTest {
@Test
public final void givenNoInteractionWithMockOccurred_whenVerifyingInteractions_thenCorrect() {
final List<String> mockedList = mock(MyList.class);
verifyZeroInteractions(mockedList);
verifyNoInteractions(mockedList);
}
@Test
@@ -2,7 +2,6 @@ package com.baeldung.mockito;
import com.google.common.collect.Lists;
import com.baeldung.mockito.MyList;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
@@ -13,7 +12,6 @@ import java.util.List;
import static org.hamcrest.Matchers.hasItem;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
public class MockitoVerifyExamplesUnitTest {
@@ -37,7 +35,7 @@ public class MockitoVerifyExamplesUnitTest {
@Test
public final void givenNoInteractionWithMockOccurred_whenVerifyingInteractions_thenCorrect() {
final List<String> mockedList = mock(MyList.class);
verifyZeroInteractions(mockedList);
verifyNoInteractions(mockedList);
}
@Test