Remove redundant throws clauses
Removes exceptions that are declared in a method's signature but never thrown by the method itself or its implementations/derivatives.
This commit is contained in:
@@ -39,7 +39,7 @@ public class HelloWebfluxMethodApplicationITests {
|
||||
|
||||
|
||||
@Test
|
||||
public void messageWhenNotAuthenticated() throws Exception {
|
||||
public void messageWhenNotAuthenticated() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/message")
|
||||
@@ -48,7 +48,7 @@ public class HelloWebfluxMethodApplicationITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void messageWhenUserThenForbidden() throws Exception {
|
||||
public void messageWhenUserThenForbidden() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/message")
|
||||
@@ -58,7 +58,7 @@ public class HelloWebfluxMethodApplicationITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void messageWhenAdminThenOk() throws Exception {
|
||||
public void messageWhenAdminThenOk() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/message")
|
||||
|
||||
@@ -36,7 +36,7 @@ import static org.springframework.security.config.Customizer.withDefaults;
|
||||
public class SecurityConfig {
|
||||
|
||||
@Bean
|
||||
SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) throws Exception {
|
||||
SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) {
|
||||
return http
|
||||
// Demonstrate that method security works
|
||||
// Best practice to use both for defense in depth
|
||||
|
||||
@@ -50,7 +50,7 @@ public class HelloWebfluxMethodApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void messageWhenNotAuthenticated() throws Exception {
|
||||
public void messageWhenNotAuthenticated() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/message")
|
||||
@@ -61,7 +61,7 @@ public class HelloWebfluxMethodApplicationTests {
|
||||
// --- Basic Authentication ---
|
||||
|
||||
@Test
|
||||
public void messageWhenUserThenForbidden() throws Exception {
|
||||
public void messageWhenUserThenForbidden() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/message")
|
||||
@@ -71,7 +71,7 @@ public class HelloWebfluxMethodApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void messageWhenAdminThenOk() throws Exception {
|
||||
public void messageWhenAdminThenOk() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/message")
|
||||
@@ -85,7 +85,7 @@ public class HelloWebfluxMethodApplicationTests {
|
||||
|
||||
@Test
|
||||
@WithMockUser
|
||||
public void messageWhenWithMockUserThenForbidden() throws Exception {
|
||||
public void messageWhenWithMockUserThenForbidden() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/message")
|
||||
@@ -95,7 +95,7 @@ public class HelloWebfluxMethodApplicationTests {
|
||||
|
||||
@Test
|
||||
@WithMockUser(roles = "ADMIN")
|
||||
public void messageWhenWithMockAdminThenOk() throws Exception {
|
||||
public void messageWhenWithMockAdminThenOk() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/message")
|
||||
@@ -107,7 +107,7 @@ public class HelloWebfluxMethodApplicationTests {
|
||||
// --- mutateWith mockUser ---
|
||||
|
||||
@Test
|
||||
public void messageWhenMutateWithMockUserThenForbidden() throws Exception {
|
||||
public void messageWhenMutateWithMockUserThenForbidden() {
|
||||
this.rest
|
||||
.mutateWith(mockUser())
|
||||
.get()
|
||||
@@ -117,7 +117,7 @@ public class HelloWebfluxMethodApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void messageWhenMutateWithMockAdminThenOk() throws Exception {
|
||||
public void messageWhenMutateWithMockAdminThenOk() {
|
||||
this.rest
|
||||
.mutateWith(mockUser().roles("ADMIN"))
|
||||
.get()
|
||||
|
||||
@@ -37,7 +37,7 @@ public class HelloWebfluxApplicationITests {
|
||||
WebTestClient rest;
|
||||
|
||||
@Test
|
||||
public void basicWhenNoCredentialsThenUnauthorized() throws Exception {
|
||||
public void basicWhenNoCredentialsThenUnauthorized() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -46,7 +46,7 @@ public class HelloWebfluxApplicationITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenValidCredentialsThenOk() throws Exception {
|
||||
public void basicWhenValidCredentialsThenOk() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -57,7 +57,7 @@ public class HelloWebfluxApplicationITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenInvalidCredentialsThenUnauthorized() throws Exception {
|
||||
public void basicWhenInvalidCredentialsThenUnauthorized() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
|
||||
@@ -51,7 +51,7 @@ public class HelloWebfluxApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenNoCredentialsThenUnauthorized() throws Exception {
|
||||
public void basicWhenNoCredentialsThenUnauthorized() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -60,7 +60,7 @@ public class HelloWebfluxApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenValidCredentialsThenOk() throws Exception {
|
||||
public void basicWhenValidCredentialsThenOk() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -71,7 +71,7 @@ public class HelloWebfluxApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenInvalidCredentialsThenUnauthorized() throws Exception {
|
||||
public void basicWhenInvalidCredentialsThenUnauthorized() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -82,7 +82,7 @@ public class HelloWebfluxApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mockSupportWhenMutateWithMockUserThenOk() throws Exception {
|
||||
public void mockSupportWhenMutateWithMockUserThenOk() {
|
||||
this.rest
|
||||
.mutateWith(mockUser())
|
||||
.get()
|
||||
@@ -94,7 +94,7 @@ public class HelloWebfluxApplicationTests {
|
||||
|
||||
@Test
|
||||
@WithMockUser
|
||||
public void mockSupportWhenWithMockUserThenOk() throws Exception {
|
||||
public void mockSupportWhenWithMockUserThenOk() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
|
||||
@@ -43,7 +43,7 @@ public class HelloWebfluxFnApplicationITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenNoCredentialsThenUnauthorized() throws Exception {
|
||||
public void basicWhenNoCredentialsThenUnauthorized() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -52,7 +52,7 @@ public class HelloWebfluxFnApplicationITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenValidCredentialsThenOk() throws Exception {
|
||||
public void basicWhenValidCredentialsThenOk() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -63,7 +63,7 @@ public class HelloWebfluxFnApplicationITests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenInvalidCredentialsThenUnauthorized() throws Exception {
|
||||
public void basicWhenInvalidCredentialsThenUnauthorized() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
|
||||
@@ -52,7 +52,7 @@ public class HelloWebfluxFnApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenNoCredentialsThenUnauthorized() throws Exception {
|
||||
public void basicWhenNoCredentialsThenUnauthorized() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -61,7 +61,7 @@ public class HelloWebfluxFnApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenValidCredentialsThenOk() throws Exception {
|
||||
public void basicWhenValidCredentialsThenOk() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -72,7 +72,7 @@ public class HelloWebfluxFnApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basicWhenInvalidCredentialsThenUnauthorized() throws Exception {
|
||||
public void basicWhenInvalidCredentialsThenUnauthorized() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
@@ -83,7 +83,7 @@ public class HelloWebfluxFnApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mockSupportWhenMutateWithMockUserThenOk() throws Exception {
|
||||
public void mockSupportWhenMutateWithMockUserThenOk() {
|
||||
this.rest
|
||||
.mutateWith(mockUser())
|
||||
.get()
|
||||
@@ -95,7 +95,7 @@ public class HelloWebfluxFnApplicationTests {
|
||||
|
||||
@Test
|
||||
@WithMockUser
|
||||
public void mockSupportWhenWithMockUserThenOk() throws Exception {
|
||||
public void mockSupportWhenWithMockUserThenOk() {
|
||||
this.rest
|
||||
.get()
|
||||
.uri("/")
|
||||
|
||||
@@ -116,7 +116,7 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
|
||||
public void configure(AuthorizationServerEndpointsConfigurer endpoints) {
|
||||
// @formatter:off
|
||||
endpoints
|
||||
.authenticationManager(this.authenticationManager)
|
||||
|
||||
@@ -291,7 +291,7 @@ public class OAuth2LoginApplicationTests {
|
||||
assertThat(errorElement.asText()).contains("invalid_redirect_uri_parameter");
|
||||
}
|
||||
|
||||
private void assertLoginPage(HtmlPage page) throws Exception {
|
||||
private void assertLoginPage(HtmlPage page) {
|
||||
assertThat(page.getTitleText()).isEqualTo("Please sign in");
|
||||
|
||||
int expectedClients = 4;
|
||||
@@ -322,7 +322,7 @@ public class OAuth2LoginApplicationTests {
|
||||
}
|
||||
}
|
||||
|
||||
private void assertIndexPage(HtmlPage page) throws Exception {
|
||||
private void assertIndexPage(HtmlPage page) {
|
||||
assertThat(page.getTitleText()).isEqualTo("Spring Security - OAuth 2.0 Login");
|
||||
|
||||
DomNodeList<HtmlElement> divElements = page.getBody().getElementsByTagName("div");
|
||||
|
||||
@@ -94,7 +94,7 @@ public class MockWebServerPropertySource extends PropertySource<MockWebServer> i
|
||||
private void intializeMockWebServer(MockWebServer mockWebServer) {
|
||||
Dispatcher dispatcher = new Dispatcher() {
|
||||
@Override
|
||||
public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
|
||||
public MockResponse dispatch(RecordedRequest request) {
|
||||
if ("/.well-known/jwks.json".equals(request.getPath())) {
|
||||
return JWKS_RESPONSE;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class MockWebServerPropertySource extends PropertySource<MockWebServer> i
|
||||
private void intializeMockWebServer(MockWebServer mockWebServer) {
|
||||
Dispatcher dispatcher = new Dispatcher() {
|
||||
@Override
|
||||
public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
|
||||
public MockResponse dispatch(RecordedRequest request) {
|
||||
if ("/.well-known/jwks.json".equals(request.getPath())) {
|
||||
return JWKS_RESPONSE;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.springframework.security.config.Customizer.withDefaults;
|
||||
public class SecurityConfig {
|
||||
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) throws Exception {
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange(exchanges ->
|
||||
exchanges
|
||||
|
||||
@@ -93,7 +93,7 @@ public class MockWebServerPropertySource extends PropertySource<MockWebServer> i
|
||||
private void intializeMockWebServer(MockWebServer mockWebServer) {
|
||||
Dispatcher dispatcher = new Dispatcher() {
|
||||
@Override
|
||||
public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
|
||||
public MockResponse dispatch(RecordedRequest request) {
|
||||
if ("/.well-known/jwks.json".equals(request.getPath())) {
|
||||
return JWKS_RESPONSE;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.springframework.security.config.Customizer.withDefaults;
|
||||
public class SecurityConfig {
|
||||
|
||||
@Bean
|
||||
SecurityWebFilterChain configure(ServerHttpSecurity http) throws Exception {
|
||||
SecurityWebFilterChain configure(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange(exchanges ->
|
||||
exchanges
|
||||
|
||||
@@ -47,7 +47,7 @@ public class WebfluxFormApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginWhenInvalidUsernameThenError() throws Exception {
|
||||
public void loginWhenInvalidUsernameThenError() {
|
||||
LoginPage login = IndexPage.to(this.driver, this.port, LoginPage.class);
|
||||
login.assertAt();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class WebfluxFormApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginAndLogout() throws Exception {
|
||||
public void loginAndLogout() {
|
||||
LoginPage login = IndexPage.to(this.driver, this.port, LoginPage.class);
|
||||
login.assertAt();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user