Skip to content

Commit

Permalink
Merge pull request #2448 from uPortal-Project/renovate/major-mockito
Browse files Browse the repository at this point in the history
chore(deps): update mockito to v4 (major)
  • Loading branch information
ChristianMurphy authored Oct 12, 2021
2 parents 15a9708 + 1ff2f19 commit 9783819
Show file tree
Hide file tree
Showing 30 changed files with 87 additions and 83 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ junitVersion=4.13.2
lesscssVersion=1.7.0.1.1
logbackVersion=1.2.6
lombokVersion=1.18.22
mockitoVersion=3.12.4
mockitoVersion=4.0.0
luceneVersion=8.9.0
nodejsVersion=16.2.0
oauthVersion=20100527
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void testIngoresGuestUserProfileSelections() {

stickyMapper.onApplicationEvent(selectionEvent);

verifyZeroInteractions(registry);
verifyNoMoreInteractions(registry);
}

/**
Expand Down Expand Up @@ -164,7 +164,7 @@ public void testIgnoresSelectionWhenIdentitySwapped() {

stickyMapper.onApplicationEvent(selectionEvent);

verifyZeroInteractions(registry);
verifyNoMoreInteractions(registry);
}

/**
Expand All @@ -178,7 +178,7 @@ public void testIgnoresInvalidProfileKey() {

stickyMapper.onApplicationEvent(selectionEvent);

verifyZeroInteractions(registry);
verifyNoMoreInteractions(registry);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void rendersFalsePipeWhenPredicateIsFalse() throws ServletException, IOEx
boolean outcome = renderingPipelineBranchPoint.renderStateIfApplicable(request, response);

assertFalse("Expected outcome == true", outcome);
verifyZeroInteractions(alternatePipe);
verifyNoMoreInteractions(alternatePipe);
}

/** Test that RenderingPipelineBranchPoint has a friendly toString() implementation. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import java.io.IOException;
Expand Down Expand Up @@ -78,8 +78,8 @@ public void timeSetOutsideRefreshDurationWorkflow() throws IOException, ServletE
verify(person, times(1)).getAttribute(SESSION_MAX_INACTIVE_SET_ATTR);
verify(person, times(1)).getAttribute(IPerson.USERNAME);
verify(personManager, times(1)).getPerson(req);
verifyZeroInteractions(resp);
verifyZeroInteractions(session);
verifyNoMoreInteractions(resp);
verifyNoMoreInteractions(session);
verify(chain, only()).doFilter(req, resp);
}

Expand Down Expand Up @@ -119,7 +119,7 @@ public void noTimeSetWorkflow() throws IOException, ServletException {
verify(person, times(1)).getAttribute(SESSION_MAX_INACTIVE_SET_ATTR);
verify(person, times(2)).getAttribute(IPerson.USERNAME);
verify(personManager, times(1)).getPerson(req);
verifyZeroInteractions(resp);
verifyNoMoreInteractions(resp);
verify(chain, only()).doFilter(req, resp);
}

Expand Down Expand Up @@ -154,9 +154,9 @@ public void timeSetInsideRefreshDurationWorkflow() throws IOException, ServletEx
verify(person, times(1)).getAttribute(SESSION_MAX_INACTIVE_SET_ATTR);
verify(person, times(1)).getAttribute(IPerson.USERNAME);
verify(personManager, times(1)).getPerson(req);
verifyZeroInteractions(maxInactiveStrategy);
verifyZeroInteractions(resp);
verifyZeroInteractions(session);
verifyNoMoreInteractions(maxInactiveStrategy);
verifyNoMoreInteractions(resp);
verifyNoMoreInteractions(session);
verify(chain, only()).doFilter(req, resp);
}

Expand Down Expand Up @@ -188,9 +188,9 @@ public void notAuthenticatedWorkflow() throws IOException, ServletException {
verify(person, times(1)).getSecurityContext();
verify(person, times(1)).getAttribute(IPerson.USERNAME);
verify(personManager, times(1)).getPerson(req);
verifyZeroInteractions(maxInactiveStrategy);
verifyZeroInteractions(resp);
verifyZeroInteractions(session);
verifyNoMoreInteractions(maxInactiveStrategy);
verifyNoMoreInteractions(resp);
verifyNoMoreInteractions(session);
verify(chain, only()).doFilter(req, resp);
}

Expand Down Expand Up @@ -219,9 +219,9 @@ public void noSecurityContextWorkflow() throws IOException, ServletException {
verify(person, times(1)).getSecurityContext();
verify(person, times(1)).getAttribute(IPerson.USERNAME);
verify(personManager, times(1)).getPerson(req);
verifyZeroInteractions(maxInactiveStrategy);
verifyZeroInteractions(resp);
verifyZeroInteractions(session);
verifyNoMoreInteractions(maxInactiveStrategy);
verifyNoMoreInteractions(resp);
verifyNoMoreInteractions(session);
verify(chain, only()).doFilter(req, resp);
}

Expand All @@ -245,9 +245,9 @@ public void noPersonWorkflow() throws IOException, ServletException {
filter.doFilter(req, resp, chain);

verify(personManager, times(1)).getPerson(req);
verifyZeroInteractions(maxInactiveStrategy);
verifyZeroInteractions(resp);
verifyZeroInteractions(session);
verifyNoMoreInteractions(maxInactiveStrategy);
verifyNoMoreInteractions(resp);
verifyNoMoreInteractions(session);
verify(chain, only()).doFilter(req, resp);
}

Expand All @@ -268,9 +268,9 @@ public void noSessionWorkflow() throws IOException, ServletException {

filter.doFilter(req, resp, chain);

verifyZeroInteractions(personManager);
verifyZeroInteractions(maxInactiveStrategy);
verifyZeroInteractions(resp);
verifyNoMoreInteractions(personManager);
verifyNoMoreInteractions(maxInactiveStrategy);
verifyNoMoreInteractions(resp);
verify(req, only()).getSession(false);
verify(chain, only()).doFilter(req, resp);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasKey;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.ArgumentMatchers;
import org.springframework.core.env.PropertyResolver;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
Expand All @@ -50,13 +50,16 @@ public void testInterceptor() throws Exception {
final String secretKey = "secretKey";

PropertyResolver resolver = mock(PropertyResolver.class);
when(resolver.getProperty(Matchers.eq("org.jasig.rest.interceptor.oauth." + id + ".realm")))
when(resolver.getProperty(
ArgumentMatchers.eq("org.jasig.rest.interceptor.oauth." + id + ".realm")))
.thenReturn(realm);
when(resolver.getProperty(
Matchers.eq("org.jasig.rest.interceptor.oauth." + id + ".consumerKey")))
ArgumentMatchers.eq(
"org.jasig.rest.interceptor.oauth." + id + ".consumerKey")))
.thenReturn(consumerKey);
when(resolver.getProperty(
Matchers.eq("org.jasig.rest.interceptor.oauth." + id + ".secretKey")))
ArgumentMatchers.eq(
"org.jasig.rest.interceptor.oauth." + id + ".secretKey")))
.thenReturn(secretKey);

// holder for the headers...
Expand All @@ -74,7 +77,8 @@ public void testInterceptor() throws Exception {
when(client.execute()).thenReturn(resp);

ClientHttpRequestFactory factory = mock(ClientHttpRequestFactory.class);
when(factory.createRequest(Matchers.any(URI.class), Matchers.any(HttpMethod.class)))
when(factory.createRequest(
ArgumentMatchers.any(URI.class), ArgumentMatchers.any(HttpMethod.class)))
.thenReturn(client);

// add the new interceptor...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand All @@ -40,7 +40,7 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;

// @Ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class AnalyticsIncorporationComponentEventSerializationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class AggregationIntervalHelperImplTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

/** */
@RunWith(MockitoJUnitRunner.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
*/
package org.apereo.portal.events.aggr;

import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
Expand All @@ -38,10 +38,10 @@
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

@Ignore // Breaks on move to Gradlde
@RunWith(MockitoJUnitRunner.class)
Expand Down Expand Up @@ -82,7 +82,7 @@ public void populateAllTimeDimensions() {

verify(timeDimensionDao).getTimeDimensions();
verify(timeDimensionDao, times(60 * 24))
.createTimeDimension(Matchers.<LocalTime>anyObject());
.createTimeDimension(ArgumentMatchers.<LocalTime>any());
verifyNoMoreInteractions(timeDimensionDao, dateDimensionDao);
}

Expand Down Expand Up @@ -112,7 +112,7 @@ public void populateSomeTimeDimensions() {

verify(timeDimensionDao).getTimeDimensions();
verify(timeDimensionDao, times((60 * 24) - existingTimeDimensions.size()))
.createTimeDimension(Matchers.<LocalTime>anyObject());
.createTimeDimension(ArgumentMatchers.<LocalTime>any());
verifyNoMoreInteractions(timeDimensionDao, dateDimensionDao);
}

Expand Down Expand Up @@ -154,7 +154,7 @@ public void populateDefaultDateDimensions() {
.getDateDimensionsBetween(any(DateMidnight.class), any(DateMidnight.class));

verify(dateDimensionDao, times(365))
.createDateDimension(Matchers.<DateMidnight>anyObject(), anyInt(), anyString());
.createDateDimension(ArgumentMatchers.<DateMidnight>any(), anyInt(), anyString());
verifyNoMoreInteractions(timeDimensionDao, dateDimensionDao);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static org.mockito.Matchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand All @@ -37,7 +37,7 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package org.apereo.portal.io.xml;

import static org.mockito.Matchers.anyString;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;

import com.google.common.base.Function;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Matchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
Expand Down Expand Up @@ -53,7 +53,7 @@
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class VersionedDataUpdaterImplTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

/** Test CachingPortletOutputHandler */
@Ignore // Breaks on move to Gradlde
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

/** Test CachingPortletResourceOutputHandler */
@Ignore // Breaks on move to Gradlde
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*/
package org.apereo.portal.portlet.container.cache;

import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.eq;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
Expand All @@ -27,7 +27,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

/** */
@Ignore // Breaks on move to Gradlde
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpSession;

Expand Down
Loading

0 comments on commit 9783819

Please sign in to comment.