Move inner-types so that they are always last
Move all inner-types so that they are consistently the last item defined. This aligns with the style used by Spring Framework and the consistency generally makes it easier to scan the source. Issue gh-8945
This commit is contained in:
+8
-8
@@ -57,6 +57,14 @@ public class ReactorContextTestExecutionListener extends DelegatingTestExecution
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code 11000}.
|
||||
*/
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 11000;
|
||||
}
|
||||
|
||||
private static class DelegateTestExecutionListener extends AbstractTestExecutionListener {
|
||||
|
||||
@Override
|
||||
@@ -124,12 +132,4 @@ public class ReactorContextTestExecutionListener extends DelegatingTestExecution
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code 11000}.
|
||||
*/
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 11000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -76,6 +76,10 @@ public class WithUserDetailsTests {
|
||||
assertThat(getPrincipal()).isInstanceOf(CustomUserDetails.class);
|
||||
}
|
||||
|
||||
private Object getPrincipal() {
|
||||
return SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
}
|
||||
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
@ComponentScan(basePackageClasses = HelloMessageService.class)
|
||||
static class Config {
|
||||
@@ -95,10 +99,6 @@ public class WithUserDetailsTests {
|
||||
|
||||
}
|
||||
|
||||
private Object getPrincipal() {
|
||||
return SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
}
|
||||
|
||||
static class CustomUserDetailsService implements UserDetailsService {
|
||||
|
||||
@Override
|
||||
|
||||
+20
-20
@@ -100,26 +100,6 @@ public class ReactorContextTestExecutionListenerTests {
|
||||
assertSecurityContext(context);
|
||||
}
|
||||
|
||||
static class CustomContext implements SecurityContext {
|
||||
|
||||
private Authentication authentication;
|
||||
|
||||
CustomContext(Authentication authentication) {
|
||||
this.authentication = authentication;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication getAuthentication() {
|
||||
return this.authentication;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthentication(Authentication authentication) {
|
||||
this.authentication = authentication;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beforeTestMethodWhenExistingAuthenticationThenReactorContextHasOriginalAuthentication()
|
||||
throws Exception {
|
||||
@@ -215,4 +195,24 @@ public class ReactorContextTestExecutionListenerTests {
|
||||
StepVerifier.create(securityContext).expectNext(expected).verifyComplete();
|
||||
}
|
||||
|
||||
static class CustomContext implements SecurityContext {
|
||||
|
||||
private Authentication authentication;
|
||||
|
||||
CustomContext(Authentication authentication) {
|
||||
this.authentication = authentication;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication getAuthentication() {
|
||||
return this.authentication;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthentication(Authentication authentication) {
|
||||
this.authentication = authentication;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-10
@@ -36,11 +36,6 @@ public class WithAnonymousUserTests {
|
||||
assertThat(context.setupBefore()).isEqualTo(TestExecutionEvent.TEST_METHOD);
|
||||
}
|
||||
|
||||
@WithAnonymousUser
|
||||
private class Annotated {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findMergedAnnotationWhenSetupExplicitThenOverridden() {
|
||||
WithSecurityContext context = AnnotatedElementUtils.findMergedAnnotation(SetupExplicit.class,
|
||||
@@ -49,11 +44,6 @@ public class WithAnonymousUserTests {
|
||||
assertThat(context.setupBefore()).isEqualTo(TestExecutionEvent.TEST_METHOD);
|
||||
}
|
||||
|
||||
@WithAnonymousUser(setupBefore = TestExecutionEvent.TEST_METHOD)
|
||||
private class SetupExplicit {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findMergedAnnotationWhenSetupOverriddenThenOverridden() {
|
||||
WithSecurityContext context = AnnotatedElementUtils.findMergedAnnotation(SetupOverridden.class,
|
||||
@@ -62,6 +52,16 @@ public class WithAnonymousUserTests {
|
||||
assertThat(context.setupBefore()).isEqualTo(TestExecutionEvent.TEST_EXECUTION);
|
||||
}
|
||||
|
||||
@WithAnonymousUser
|
||||
private class Annotated {
|
||||
|
||||
}
|
||||
|
||||
@WithAnonymousUser(setupBefore = TestExecutionEvent.TEST_METHOD)
|
||||
private class SetupExplicit {
|
||||
|
||||
}
|
||||
|
||||
@WithAnonymousUser(setupBefore = TestExecutionEvent.TEST_EXECUTION)
|
||||
private class SetupOverridden {
|
||||
|
||||
|
||||
+10
-10
@@ -39,11 +39,6 @@ public class WithMockUserTests {
|
||||
assertThat(context.setupBefore()).isEqualTo(TestExecutionEvent.TEST_METHOD);
|
||||
}
|
||||
|
||||
@WithMockUser
|
||||
private class Annotated {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findMergedAnnotationWhenSetupExplicitThenOverridden() {
|
||||
WithSecurityContext context = AnnotatedElementUtils.findMergedAnnotation(SetupExplicit.class,
|
||||
@@ -52,11 +47,6 @@ public class WithMockUserTests {
|
||||
assertThat(context.setupBefore()).isEqualTo(TestExecutionEvent.TEST_METHOD);
|
||||
}
|
||||
|
||||
@WithMockUser(setupBefore = TestExecutionEvent.TEST_METHOD)
|
||||
private class SetupExplicit {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findMergedAnnotationWhenSetupOverriddenThenOverridden() {
|
||||
WithSecurityContext context = AnnotatedElementUtils.findMergedAnnotation(SetupOverridden.class,
|
||||
@@ -65,6 +55,16 @@ public class WithMockUserTests {
|
||||
assertThat(context.setupBefore()).isEqualTo(TestExecutionEvent.TEST_EXECUTION);
|
||||
}
|
||||
|
||||
@WithMockUser
|
||||
private class Annotated {
|
||||
|
||||
}
|
||||
|
||||
@WithMockUser(setupBefore = TestExecutionEvent.TEST_METHOD)
|
||||
private class SetupExplicit {
|
||||
|
||||
}
|
||||
|
||||
@WithMockUser(setupBefore = TestExecutionEvent.TEST_EXECUTION)
|
||||
private class SetupOverridden {
|
||||
|
||||
|
||||
+10
-10
@@ -35,11 +35,6 @@ public class WithUserDetailsTests {
|
||||
assertThat(context.setupBefore()).isEqualTo(TestExecutionEvent.TEST_METHOD);
|
||||
}
|
||||
|
||||
@WithUserDetails
|
||||
private static class Annotated {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findMergedAnnotationWhenSetupExplicitThenOverridden() {
|
||||
WithSecurityContext context = AnnotatedElementUtils.findMergedAnnotation(SetupExplicit.class,
|
||||
@@ -48,11 +43,6 @@ public class WithUserDetailsTests {
|
||||
assertThat(context.setupBefore()).isEqualTo(TestExecutionEvent.TEST_METHOD);
|
||||
}
|
||||
|
||||
@WithUserDetails(setupBefore = TestExecutionEvent.TEST_METHOD)
|
||||
private class SetupExplicit {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findMergedAnnotationWhenSetupOverriddenThenOverridden() {
|
||||
WithSecurityContext context = AnnotatedElementUtils.findMergedAnnotation(SetupOverridden.class,
|
||||
@@ -61,6 +51,16 @@ public class WithUserDetailsTests {
|
||||
assertThat(context.setupBefore()).isEqualTo(TestExecutionEvent.TEST_EXECUTION);
|
||||
}
|
||||
|
||||
@WithUserDetails
|
||||
private static class Annotated {
|
||||
|
||||
}
|
||||
|
||||
@WithUserDetails(setupBefore = TestExecutionEvent.TEST_METHOD)
|
||||
private class SetupExplicit {
|
||||
|
||||
}
|
||||
|
||||
@WithUserDetails(setupBefore = TestExecutionEvent.TEST_EXECUTION)
|
||||
private class SetupOverridden {
|
||||
|
||||
|
||||
+4
-4
@@ -172,6 +172,10 @@ public class SecurityMockMvcRequestPostProcessorsCsrfTests {
|
||||
return new CsrfParamResultMatcher();
|
||||
}
|
||||
|
||||
public static ResultMatcher csrfAsHeader() {
|
||||
return new CsrfHeaderResultMatcher();
|
||||
}
|
||||
|
||||
static class CsrfParamResultMatcher implements ResultMatcher {
|
||||
|
||||
@Override
|
||||
@@ -183,10 +187,6 @@ public class SecurityMockMvcRequestPostProcessorsCsrfTests {
|
||||
|
||||
}
|
||||
|
||||
public static ResultMatcher csrfAsHeader() {
|
||||
return new CsrfHeaderResultMatcher();
|
||||
}
|
||||
|
||||
static class CsrfHeaderResultMatcher implements ResultMatcher {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user