1
0
mirror of synced 2026-05-22 21:33:16 +00:00

Update to Mockito 2.10.0

Issue: gh-4608
This commit is contained in:
Rob Winch
2017-10-09 13:19:21 -05:00
parent 74aa8bc803
commit 445834784a
40 changed files with 78 additions and 114 deletions
+1 -1
View File
@@ -17,5 +17,5 @@ dependencies {
testCompile 'org.skyscreamer:jsonassert'
testCompile 'org.springframework:spring-webmvc'
testCompile 'org.springframework:spring-tx'
testCompile powerMockDependencies
testCompile powerMock2Dependencies
}
@@ -55,7 +55,6 @@ public class WithMockUserSecurityContextFactoryTests {
@Test
public void usernamePrioritizedOverValue() {
when(withUser.value()).thenReturn("valueUser");
when(withUser.username()).thenReturn("customUser");
when(withUser.password()).thenReturn("password");
when(withUser.roles()).thenReturn(new String[] { "USER" });
@@ -94,7 +93,6 @@ public class WithMockUserSecurityContextFactoryTests {
@Test(expected = IllegalStateException.class)
public void authoritiesAndRolesInvalid() {
when(withUser.value()).thenReturn("valueUser");
when(withUser.password()).thenReturn("password");
when(withUser.roles()).thenReturn(new String[] { "CUSTOM" });
when(withUser.authorities()).thenReturn(new String[] { "USER", "CUSTOM" });
@@ -104,7 +102,6 @@ public class WithMockUserSecurityContextFactoryTests {
@Test(expected = IllegalArgumentException.class)
public void rolesWithRolePrefixFails() {
when(withUser.value()).thenReturn("valueUser");
when(withUser.password()).thenReturn("password");
when(withUser.roles()).thenReturn(new String[] { "ROLE_FAIL" });
when(withUser.authorities()).thenReturn(new String[] {});
@@ -75,7 +75,6 @@ public class WithSecurityContextTestExcecutionListenerTests {
@SuppressWarnings({ "rawtypes", "unchecked" })
public void beforeTestMethodNullSecurityContextNoError() throws Exception {
Class testClass = FakeTest.class;
when(testContext.getApplicationContext()).thenReturn(context);
when(testContext.getTestClass()).thenReturn(testClass);
when(testContext.getTestMethod()).thenReturn(
ReflectionUtils.findMethod(testClass, "testNoAnnotation"));
@@ -88,7 +87,6 @@ public class WithSecurityContextTestExcecutionListenerTests {
public void beforeTestMethodNoApplicationContext() throws Exception {
Class testClass = FakeTest.class;
when(testContext.getApplicationContext()).thenThrow(new IllegalStateException());
when(testContext.getTestClass()).thenReturn(testClass);
when(testContext.getTestMethod()).thenReturn(
ReflectionUtils.findMethod(testClass, "testWithMockUser"));
@@ -32,6 +32,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareOnlyThisForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -43,6 +44,7 @@ import org.springframework.security.web.context.SecurityContextRepository;
@RunWith(PowerMockRunner.class)
@PrepareOnlyThisForTest(WebTestUtils.class)
@PowerMockIgnore("javax.security.auth.*")
public class SecurityMockMvcRequestPostProcessorsAuthenticationTests {
@Captor
private ArgumentCaptor<SecurityContext> contextCaptor;
@@ -79,4 +81,4 @@ public class SecurityMockMvcRequestPostProcessorsAuthenticationTests {
spy(WebTestUtils.class);
when(WebTestUtils.getSecurityContextRepository(request)).thenReturn(repository);
}
}
}