Update MockitJunitRunner import

Issue: gh-4608
This commit is contained in:
Rob Winch
2017-10-09 13:20:49 -05:00
parent 445834784a
commit 23f56f568c
81 changed files with 218 additions and 218 deletions

View File

@@ -28,7 +28,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.csrf.CsrfException;
import org.springframework.security.web.csrf.InvalidCsrfTokenException;

View File

@@ -21,7 +21,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.support.StaticApplicationContext;

View File

@@ -23,7 +23,7 @@ import org.junit.Test;
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.expression.BeanResolver;
import org.springframework.expression.ConstructorResolver;
@@ -141,4 +141,4 @@ public class DelegatingEvaluationContextTests {
assertThat(this.context.lookupVariable(name)).isEqualTo(expected);
}
}
}

View File

@@ -21,7 +21,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.security.authentication.AccountExpiredException;
import org.springframework.security.authentication.AccountStatusException;
import org.springframework.security.authentication.BadCredentialsException;

View File

@@ -1,118 +1,118 @@
/*
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.security.web.authentication.logout;
import java.util.LinkedHashMap;
import javax.servlet.http.HttpServletRequest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.util.matcher.RequestMatcher;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
/**
* DelegatingLogoutSuccessHandlerTests Tests
*
* @author Shazin Sadakath
* @author Rob Winch
*/
@RunWith(MockitoJUnitRunner.class)
public class DelegatingLogoutSuccessHandlerTests {
@Mock
RequestMatcher matcher;
@Mock
RequestMatcher matcher2;
@Mock
LogoutSuccessHandler handler;
@Mock
LogoutSuccessHandler handler2;
@Mock
LogoutSuccessHandler defaultHandler;
@Mock
HttpServletRequest request;
@Mock
MockHttpServletResponse response;
@Mock
Authentication authentication;
DelegatingLogoutSuccessHandler delegatingHandler;
@Before
public void setup() {
LinkedHashMap<RequestMatcher, LogoutSuccessHandler> matcherToHandler = new LinkedHashMap<RequestMatcher, LogoutSuccessHandler>();
matcherToHandler.put(this.matcher, this.handler);
matcherToHandler.put(this.matcher2, this.handler2);
this.delegatingHandler = new DelegatingLogoutSuccessHandler(matcherToHandler);
}
@Test
public void onLogoutSuccessFirstMatches() throws Exception {
this.delegatingHandler.setDefaultLogoutSuccessHandler(this.defaultHandler);
when(this.matcher.matches(this.request)).thenReturn(true);
this.delegatingHandler.onLogoutSuccess(this.request, this.response,
this.authentication);
verify(this.handler).onLogoutSuccess(this.request, this.response,
this.authentication);
verifyZeroInteractions(this.matcher2, this.handler2, this.defaultHandler);
}
@Test
public void onLogoutSuccessSecondMatches() throws Exception {
this.delegatingHandler.setDefaultLogoutSuccessHandler(this.defaultHandler);
when(this.matcher2.matches(this.request)).thenReturn(true);
this.delegatingHandler.onLogoutSuccess(this.request, this.response,
this.authentication);
verify(this.handler2).onLogoutSuccess(this.request, this.response,
this.authentication);
verifyZeroInteractions(this.handler, this.defaultHandler);
}
@Test
public void onLogoutSuccessDefault() throws Exception {
this.delegatingHandler.setDefaultLogoutSuccessHandler(this.defaultHandler);
this.delegatingHandler.onLogoutSuccess(this.request, this.response,
this.authentication);
verify(this.defaultHandler).onLogoutSuccess(this.request, this.response,
this.authentication);
verifyZeroInteractions(this.handler, this.handler2);
}
@Test
public void onLogoutSuccessNoMatchDefaultNull() throws Exception {
this.delegatingHandler.onLogoutSuccess(this.request, this.response,
this.authentication);
verifyZeroInteractions(this.handler, this.handler2, this.defaultHandler);
}
}
/*
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.security.web.authentication.logout;
import java.util.LinkedHashMap;
import javax.servlet.http.HttpServletRequest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.util.matcher.RequestMatcher;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
/**
* DelegatingLogoutSuccessHandlerTests Tests
*
* @author Shazin Sadakath
* @author Rob Winch
*/
@RunWith(MockitoJUnitRunner.class)
public class DelegatingLogoutSuccessHandlerTests {
@Mock
RequestMatcher matcher;
@Mock
RequestMatcher matcher2;
@Mock
LogoutSuccessHandler handler;
@Mock
LogoutSuccessHandler handler2;
@Mock
LogoutSuccessHandler defaultHandler;
@Mock
HttpServletRequest request;
@Mock
MockHttpServletResponse response;
@Mock
Authentication authentication;
DelegatingLogoutSuccessHandler delegatingHandler;
@Before
public void setup() {
LinkedHashMap<RequestMatcher, LogoutSuccessHandler> matcherToHandler = new LinkedHashMap<RequestMatcher, LogoutSuccessHandler>();
matcherToHandler.put(this.matcher, this.handler);
matcherToHandler.put(this.matcher2, this.handler2);
this.delegatingHandler = new DelegatingLogoutSuccessHandler(matcherToHandler);
}
@Test
public void onLogoutSuccessFirstMatches() throws Exception {
this.delegatingHandler.setDefaultLogoutSuccessHandler(this.defaultHandler);
when(this.matcher.matches(this.request)).thenReturn(true);
this.delegatingHandler.onLogoutSuccess(this.request, this.response,
this.authentication);
verify(this.handler).onLogoutSuccess(this.request, this.response,
this.authentication);
verifyZeroInteractions(this.matcher2, this.handler2, this.defaultHandler);
}
@Test
public void onLogoutSuccessSecondMatches() throws Exception {
this.delegatingHandler.setDefaultLogoutSuccessHandler(this.defaultHandler);
when(this.matcher2.matches(this.request)).thenReturn(true);
this.delegatingHandler.onLogoutSuccess(this.request, this.response,
this.authentication);
verify(this.handler2).onLogoutSuccess(this.request, this.response,
this.authentication);
verifyZeroInteractions(this.handler, this.defaultHandler);
}
@Test
public void onLogoutSuccessDefault() throws Exception {
this.delegatingHandler.setDefaultLogoutSuccessHandler(this.defaultHandler);
this.delegatingHandler.onLogoutSuccess(this.request, this.response,
this.authentication);
verify(this.defaultHandler).onLogoutSuccess(this.request, this.response,
this.authentication);
verifyZeroInteractions(this.handler, this.handler2);
}
@Test
public void onLogoutSuccessNoMatchDefaultNull() throws Exception {
this.delegatingHandler.onLogoutSuccess(this.request, this.response,
this.authentication);
verifyZeroInteractions(this.handler, this.handler2, this.defaultHandler);
}
}

View File

@@ -39,7 +39,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.SingleConnectionDataSource;

View File

@@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.security.core.Authentication;
/**

View File

@@ -29,7 +29,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.MockHttpServletResponse;
import org.springframework.mock.web.MockHttpSession;

View File

@@ -21,7 +21,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.MockHttpServletResponse;
import org.springframework.security.authentication.TestingAuthenticationToken;

View File

@@ -24,7 +24,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;

View File

@@ -23,7 +23,7 @@ import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.context.request.NativeWebRequest;

View File

@@ -29,7 +29,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.mock.web.MockFilterChain;
import org.springframework.security.core.context.SecurityContext;

View File

@@ -22,7 +22,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.MockHttpServletResponse;

View File

@@ -29,7 +29,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.MockHttpServletResponse;

View File

@@ -21,7 +21,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.MockHttpServletResponse;
import org.springframework.security.authentication.TestingAuthenticationToken;

View File

@@ -24,7 +24,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -99,4 +99,4 @@ public class LazyCsrfTokenRepositoryTests {
verify(this.delegate).loadToken(this.request);
}
}
}

View File

@@ -24,7 +24,7 @@ import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

View File

@@ -23,7 +23,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.MockHttpServletResponse;
import org.springframework.security.web.header.HeaderWriter;

View File

@@ -22,7 +22,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
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.MockHttpServletResponse;
import org.springframework.security.web.header.writers.frameoptions.AllowFromStrategy;

View File

@@ -23,7 +23,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.core.MethodParameter;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.web.csrf.CsrfToken;

View File

@@ -24,7 +24,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.http.HttpMethod;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -216,4 +216,4 @@ public class MvcRequestMatcherTests {
new HttpRequestMethodNotSupportedException(this.request.getMethod()));
assertThat(this.matcher.matches(this.request)).isTrue();
}
}
}

View File

@@ -23,7 +23,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.security.web.util.OnCommittedResponseWrapper;

View File

@@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mock.web.MockHttpServletRequest;

View File

@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.web.util.matcher.MediaTypeRequestMatcher;

View File

@@ -23,7 +23,7 @@ import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.security.web.util.matcher.NegatedRequestMatcher;
@@ -62,4 +62,4 @@ public class NegatedRequestMatcherTests {
assertThat(matcher.matches(request)).isFalse();
}
}
}

View File

@@ -27,7 +27,7 @@ import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.security.web.util.matcher.OrRequestMatcher;
@@ -119,4 +119,4 @@ public class OrRequestMatcherTests {
assertThat(matcher.matches(request)).isTrue();
}
}
}

View File

@@ -24,7 +24,7 @@ import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mock.web.MockHttpServletRequest;
/**