Polish InterceptUrlConfigTests

Issue gh-11305
This commit is contained in:
Josh Cummings 2022-05-31 16:04:02 -06:00
parent 9dbd1f3e25
commit d994ddc9b8
No known key found for this signature in database
GPG Key ID: A306A51F43B8E5A5
1 changed files with 0 additions and 19 deletions

View File

@ -31,7 +31,6 @@ import org.springframework.mock.web.MockServletContext;
import org.springframework.security.authorization.AuthorizationManager;
import org.springframework.security.config.test.SpringTestContext;
import org.springframework.security.config.test.SpringTestContextExtension;
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.RequestPostProcessor;
import org.springframework.web.bind.annotation.PathVariable;
@ -90,8 +89,6 @@ public class InterceptUrlConfigTests {
this.mvc.perform(get("/path").with(userCredentials()))
.andExpect(status().isOk());
// @formatter:on
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class))
.isEmpty();
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull();
}
@ -125,8 +122,6 @@ public class InterceptUrlConfigTests {
this.mvc.perform(patch("/path").with(adminCredentials()))
.andExpect(status().isOk());
// @formatter:on
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class))
.isEmpty();
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull();
}
@ -150,8 +145,6 @@ public class InterceptUrlConfigTests {
this.mvc.perform(get("/path").with(adminCredentials()))
.andExpect(status().isForbidden());
// @formatter:on
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class))
.isEmpty();
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull();
}
@ -186,8 +179,6 @@ public class InterceptUrlConfigTests {
this.mvc.perform(get("/path").with(userCredentials()))
.andExpect(status().isForbidden());
// @formatter:on
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class))
.isEmpty();
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull();
}
@ -222,8 +213,6 @@ public class InterceptUrlConfigTests {
this.mvc.perform(get("/PATH/user/path").with(userCredentials()))
.andExpect(status().isForbidden());
// @formatter:on
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class))
.isEmpty();
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull();
}
@ -254,8 +243,6 @@ public class InterceptUrlConfigTests {
this.mvc.perform(get("/path/2/path").with(userCredentials()))
.andExpect(status().isForbidden());
// @formatter:on
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class))
.isEmpty();
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull();
}
@ -273,8 +260,6 @@ public class InterceptUrlConfigTests {
this.mvc.perform(get("/path")).andExpect(status().isUnauthorized());
this.mvc.perform(get("/path.html")).andExpect(status().isUnauthorized());
this.mvc.perform(get("/path/")).andExpect(status().isUnauthorized());
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class))
.isEmpty();
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull();
}
@ -303,8 +288,6 @@ public class InterceptUrlConfigTests {
this.mvc.perform(get("/PATH/user/path").with(userCredentials()))
.andExpect(status().isForbidden());
// @formatter:on
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class))
.isEmpty();
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull();
}
@ -339,8 +322,6 @@ public class InterceptUrlConfigTests {
this.mvc.perform(get("/spring/path/").servletPath("/spring"))
.andExpect(status().isUnauthorized());
// @formatter:on
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class))
.isEmpty();
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull();
}