Commit 8102dc78 authored by Madhura Bhave's avatar Madhura Bhave

Remove redundant throws declarations

parent 1ab5b833
......@@ -73,7 +73,7 @@ public class WebFluxEndpointCorsIntegrationTests {
}
@Test
public void settingAllowedOriginsEnablesCors() throws Exception {
public void settingAllowedOriginsEnablesCors() {
TestPropertyValues
.of("management.endpoints.web.cors.allowed-origins:spring.example.org")
.applyTo(this.context);
......@@ -87,7 +87,7 @@ public class WebFluxEndpointCorsIntegrationTests {
}
@Test
public void maxAgeDefaultsTo30Minutes() throws Exception {
public void maxAgeDefaultsTo30Minutes() {
TestPropertyValues
.of("management.endpoints.web.cors.allowed-origins:spring.example.org")
.applyTo(this.context);
......@@ -96,7 +96,7 @@ public class WebFluxEndpointCorsIntegrationTests {
}
@Test
public void maxAgeCanBeConfigured() throws Exception {
public void maxAgeCanBeConfigured() {
TestPropertyValues
.of("management.endpoints.web.cors.allowed-origins:spring.example.org",
"management.endpoints.web.cors.max-age: 2400")
......@@ -164,7 +164,7 @@ public class WebFluxEndpointCorsIntegrationTests {
}
@Test
public void credentialsCanBeAllowed() throws Exception {
public void credentialsCanBeAllowed() {
TestPropertyValues
.of("management.endpoints.web.cors.allowed-origins:spring.example.org",
"management.endpoints.web.cors.allow-credentials:true")
......@@ -174,7 +174,7 @@ public class WebFluxEndpointCorsIntegrationTests {
}
@Test
public void credentialsCanBeDisabled() throws Exception {
public void credentialsCanBeDisabled() {
TestPropertyValues
.of("management.endpoints.web.cors.allowed-origins:spring.example.org",
"management.endpoints.web.cors.allow-credentials:false")
......
......@@ -62,7 +62,7 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
}
@Test
public void defaultViewResolution() throws Exception {
public void defaultViewResolution() {
registerAndRefreshContext();
MockServerWebExchange exchange = render("home");
String result = exchange.getResponse().getBodyAsString().block();
......@@ -72,7 +72,7 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
}
@Test
public void customPrefix() throws Exception {
public void customPrefix() {
registerAndRefreshContext("spring.freemarker.prefix:prefix/");
MockServerWebExchange exchange = render("prefixed");
String result = exchange.getResponse().getBodyAsString().block();
......@@ -80,7 +80,7 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
}
@Test
public void customSuffix() throws Exception {
public void customSuffix() {
registerAndRefreshContext("spring.freemarker.suffix:.freemarker");
MockServerWebExchange exchange = render("suffixed");
String result = exchange.getResponse().getBodyAsString().block();
......@@ -88,7 +88,7 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
}
@Test
public void customTemplateLoaderPath() throws Exception {
public void customTemplateLoaderPath() {
registerAndRefreshContext(
"spring.freemarker.templateLoaderPath:classpath:/custom-templates/");
MockServerWebExchange exchange = render("custom");
......
......@@ -514,7 +514,7 @@ public class JacksonAutoConfigurationTests {
@Override
public void serialize(Foo value, JsonGenerator jgen,
SerializerProvider provider)
throws IOException, JsonProcessingException {
throws IOException {
jgen.writeStartObject();
jgen.writeStringField("foo", "bar");
jgen.writeEndObject();
......
......@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
......@@ -85,7 +84,7 @@ public class DataSourceJsonSerializationTests {
@Override
public void serialize(DataSource value, JsonGenerator jgen,
SerializerProvider provider) throws IOException, JsonProcessingException {
SerializerProvider provider) throws IOException {
jgen.writeStartObject();
for (PropertyDescriptor property : BeanUtils
.getPropertyDescriptors(DataSource.class)) {
......
......@@ -40,8 +40,7 @@ public class AuthenticationManagerConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner();
@Test
public void userDetailsServiceWhenPasswordEncoderAbsentAndDefaultPassword()
throws Exception {
public void userDetailsServiceWhenPasswordEncoderAbsentAndDefaultPassword() {
this.contextRunner.withUserConfiguration(TestSecurityConfiguration.class,
AuthenticationManagerConfiguration.class).run((context -> {
InMemoryUserDetailsManager userDetailsService = context
......@@ -53,20 +52,18 @@ public class AuthenticationManagerConfigurationTests {
}
@Test
public void userDetailsServiceWhenPasswordEncoderAbsentAndRawPassword()
throws Exception {
public void userDetailsServiceWhenPasswordEncoderAbsentAndRawPassword() {
testPasswordEncoding(TestSecurityConfiguration.class, "secret", "{noop}secret");
}
@Test
public void userDetailsServiceWhenPasswordEncoderAbsentAndEncodedPassword()
throws Exception {
public void userDetailsServiceWhenPasswordEncoderAbsentAndEncodedPassword() {
String password = "{bcrypt}$2a$10$sCBi9fy9814vUPf2ZRbtp.fR5/VgRk2iBFZ.ypu5IyZ28bZgxrVDa";
testPasswordEncoding(TestSecurityConfiguration.class, password, password);
}
@Test
public void userDetailsServiceWhenPasswordEncoderBeanPresent() throws Exception {
public void userDetailsServiceWhenPasswordEncoderBeanPresent() {
testPasswordEncoding(TestConfigWithPasswordEncoder.class, "secret", "secret");
}
......
......@@ -41,8 +41,7 @@ public class ReactiveAuthenticationManagerConfigurationTests {
private final ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner();
@Test
public void userDetailsServiceWhenPasswordEncoderAbsentAndDefaultPassword()
throws Exception {
public void userDetailsServiceWhenPasswordEncoderAbsentAndDefaultPassword() {
this.contextRunner
.withUserConfiguration(TestSecurityConfiguration.class,
ReactiveAuthenticationManagerConfiguration.class)
......@@ -56,20 +55,18 @@ public class ReactiveAuthenticationManagerConfigurationTests {
}
@Test
public void userDetailsServiceWhenPasswordEncoderAbsentAndRawPassword()
throws Exception {
public void userDetailsServiceWhenPasswordEncoderAbsentAndRawPassword() {
testPasswordEncoding(TestSecurityConfiguration.class, "secret", "{noop}secret");
}
@Test
public void userDetailsServiceWhenPasswordEncoderAbsentAndEncodedPassword()
throws Exception {
public void userDetailsServiceWhenPasswordEncoderAbsentAndEncodedPassword() {
String password = "{bcrypt}$2a$10$sCBi9fy9814vUPf2ZRbtp.fR5/VgRk2iBFZ.ypu5IyZ28bZgxrVDa";
testPasswordEncoding(TestSecurityConfiguration.class, password, password);
}
@Test
public void userDetailsServiceWhenPasswordEncoderBeanPresent() throws Exception {
public void userDetailsServiceWhenPasswordEncoderBeanPresent() {
testPasswordEncoding(TestConfigWithPasswordEncoder.class, "secret", "secret");
}
......
......@@ -176,7 +176,7 @@ public class DefaultErrorAttributesTests {
return ServerRequest.create(exchange, this.readers);
}
public int method(String firstParam) {
public int method() {
return 42;
}
......
......@@ -17,7 +17,6 @@
package org.springframework.boot.devtools.filewatch;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.time.Duration;
......@@ -297,7 +296,7 @@ public class FileSystemWatcherTests {
return this.changes.get(0);
}
private File touch(File file) throws FileNotFoundException, IOException {
private File touch(File file) throws IOException {
file.getParentFile().mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream(file);
fileOutputStream.close();
......
......@@ -51,7 +51,7 @@ public class OverrideAutoConfigurationEnabledFalseIntegrationTest {
private ApplicationContext context;
@Test
public void disabledAutoConfiguration() throws Exception {
public void disabledAutoConfiguration() {
ApplicationContext context = this.context;
assertThat(context.getBean(ExampleTestConfig.class)).isNotNull();
this.thrown.expect(NoSuchBeanDefinitionException.class);
......
......@@ -45,7 +45,7 @@ public class OverrideAutoConfigurationEnabledTrueIntegrationTest {
private ApplicationContext context;
@Test
public void autoConfiguredContext() throws Exception {
public void autoConfiguredContext() {
ApplicationContext context = this.context;
assertThat(context.getBean(ExampleSpringBootApplication.class)).isNotNull();
assertThat(context.getBean(ConfigurationPropertiesBindingPostProcessor.class))
......
......@@ -17,7 +17,6 @@
package org.springframework.boot.test.web.htmlunit;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import com.gargoylesoftware.htmlunit.StringWebResponse;
......@@ -91,10 +90,10 @@ public class LocalHostWebClientTests {
.isEqualTo(new URL("http://localhost:8181/test"));
}
private WebConnection mockConnection() throws MalformedURLException, IOException {
private WebConnection mockConnection() throws IOException {
WebConnection connection = mock(WebConnection.class);
WebResponse response = new StringWebResponse("test", new URL("http://localhost"));
given(connection.getResponse((WebRequest) any())).willReturn(response);
given(connection.getResponse(any())).willReturn(response);
return connection;
}
......
......@@ -17,14 +17,12 @@
package org.springframework.boot.configurationprocessor;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;
......@@ -194,7 +192,7 @@ public class TestProject {
}
private static void putContents(File targetFile, String contents)
throws FileNotFoundException, IOException, UnsupportedEncodingException {
throws IOException {
FileCopyUtils.copy(new StringReader(contents), new FileWriter(targetFile));
}
......
......@@ -18,7 +18,6 @@ package org.springframework.boot.loader.tools;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
......@@ -88,7 +87,7 @@ public class TestJarFile {
}
private void copyToFile(InputStream inputStream, File file)
throws FileNotFoundException, IOException {
throws IOException {
try (OutputStream outputStream = new FileOutputStream(file)) {
copy(inputStream, outputStream);
}
......
......@@ -55,7 +55,7 @@ public abstract class TestJarCreator {
}
private static void writeNestedEntry(String name, boolean unpackNested,
JarOutputStream jarOutputStream) throws Exception, IOException {
JarOutputStream jarOutputStream) throws Exception {
JarEntry nestedEntry = new JarEntry(name);
byte[] nestedJarData = getNestedJarData();
nestedEntry.setSize(nestedJarData.length);
......
......@@ -17,7 +17,6 @@
package org.springframework.boot.web.embedded.tomcat;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
......@@ -92,7 +91,7 @@ public class TomcatEmbeddedWebappClassLoaderTests {
return "jar:file:" + war.getAbsolutePath() + "!/WEB-INF/classes/";
}
private File createWar() throws IOException, FileNotFoundException {
private File createWar() throws IOException {
File warFile = this.temp.newFile("test.war");
try (JarOutputStream warOut = new JarOutputStream(
new FileOutputStream(warFile))) {
......
......@@ -17,7 +17,6 @@
package org.springframework.boot.context.embedded;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
......@@ -71,7 +70,7 @@ class ApplicationBuilder {
}
private File doBuildApplication(File containerFolder)
throws IOException, FileNotFoundException, MavenInvocationException {
throws IOException, MavenInvocationException {
File resourcesJar = createResourcesJar();
File appFolder = new File(containerFolder, "app");
appFolder.mkdirs();
......@@ -81,7 +80,7 @@ class ApplicationBuilder {
return new File(appFolder, "target/app-0.0.1." + this.packaging);
}
private File createResourcesJar() throws IOException, FileNotFoundException {
private File createResourcesJar() throws IOException {
File resourcesJar = new File(this.temp.getRoot(), "resources.jar");
if (resourcesJar.exists()) {
return resourcesJar;
......@@ -99,7 +98,7 @@ class ApplicationBuilder {
}
private void writePom(File appFolder, File resourcesJar)
throws FileNotFoundException, IOException {
throws IOException {
Map<String, Object> context = new HashMap<>();
context.put("packaging", this.packaging);
context.put("container", this.container);
......
......@@ -50,15 +50,14 @@ public class EmbeddedServletContainerJarDevelopmentIntegrationTests
}
@Test
public void metaInfResourceFromDependencyIsAvailableViaHttp() throws Exception {
public void metaInfResourceFromDependencyIsAvailableViaHttp() {
ResponseEntity<String> entity = this.rest
.getForEntity("/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@Test
public void metaInfResourceFromDependencyIsAvailableViaServletContext()
throws Exception {
public void metaInfResourceFromDependencyIsAvailableViaServletContext() {
ResponseEntity<String> entity = this.rest.getForEntity(
"/servletContext?/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
......
......@@ -51,28 +51,28 @@ public class EmbeddedServletContainerJarPackagingIntegrationTests
}
@Test
public void nestedMetaInfResourceIsAvailableViaHttp() throws Exception {
public void nestedMetaInfResourceIsAvailableViaHttp() {
ResponseEntity<String> entity = this.rest
.getForEntity("/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@Test
public void nestedMetaInfResourceIsAvailableViaServletContext() throws Exception {
public void nestedMetaInfResourceIsAvailableViaServletContext() {
ResponseEntity<String> entity = this.rest.getForEntity(
"/servletContext?/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@Test
public void nestedJarIsNotAvailableViaHttp() throws Exception {
public void nestedJarIsNotAvailableViaHttp() {
ResponseEntity<String> entity = this.rest
.getForEntity("/BOOT-INF/lib/resources-1.0.jar", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}
@Test
public void applicationClassesAreNotAvailableViaHttp() throws Exception {
public void applicationClassesAreNotAvailableViaHttp() {
ResponseEntity<String> entity = this.rest.getForEntity(
"/BOOT-INF/classes/com/example/ResourceHandlingApplication.class",
String.class);
......@@ -80,7 +80,7 @@ public class EmbeddedServletContainerJarPackagingIntegrationTests
}
@Test
public void launcherIsNotAvailableViaHttp() throws Exception {
public void launcherIsNotAvailableViaHttp() {
ResponseEntity<String> entity = this.rest.getForEntity(
"/org/springframework/boot/loader/Launcher.class", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
......
......@@ -50,22 +50,21 @@ public class EmbeddedServletContainerWarDevelopmentIntegrationTests
}
@Test
public void metaInfResourceFromDependencyIsAvailableViaHttp() throws Exception {
public void metaInfResourceFromDependencyIsAvailableViaHttp() {
ResponseEntity<String> entity = this.rest
.getForEntity("/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@Test
public void metaInfResourceFromDependencyIsAvailableViaServletContext()
throws Exception {
public void metaInfResourceFromDependencyIsAvailableViaServletContext() {
ResponseEntity<String> entity = this.rest.getForEntity(
"/servletContext?/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@Test
public void webappResourcesAreAvailableViaHttp() throws Exception {
public void webappResourcesAreAvailableViaHttp() {
ResponseEntity<String> entity = this.rest.getForEntity("/webapp-resource.txt",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
......
......@@ -51,28 +51,28 @@ public class EmbeddedServletContainerWarPackagingIntegrationTests
}
@Test
public void nestedMetaInfResourceIsAvailableViaHttp() throws Exception {
public void nestedMetaInfResourceIsAvailableViaHttp() {
ResponseEntity<String> entity = this.rest
.getForEntity("/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@Test
public void nestedMetaInfResourceIsAvailableViaServletContext() throws Exception {
public void nestedMetaInfResourceIsAvailableViaServletContext() {
ResponseEntity<String> entity = this.rest.getForEntity(
"/servletContext?/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@Test
public void nestedJarIsNotAvailableViaHttp() throws Exception {
public void nestedJarIsNotAvailableViaHttp() {
ResponseEntity<String> entity = this.rest
.getForEntity("/WEB-INF/lib/resources-1.0.jar", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}
@Test
public void applicationClassesAreNotAvailableViaHttp() throws Exception {
public void applicationClassesAreNotAvailableViaHttp() {
ResponseEntity<String> entity = this.rest.getForEntity(
"/WEB-INF/classes/com/example/ResourceHandlingApplication.class",
String.class);
......@@ -80,14 +80,14 @@ public class EmbeddedServletContainerWarPackagingIntegrationTests
}
@Test
public void webappResourcesAreAvailableViaHttp() throws Exception {
public void webappResourcesAreAvailableViaHttp() {
ResponseEntity<String> entity = this.rest.getForEntity("/webapp-resource.txt",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@Test
public void loaderClassesAreNotAvailableViaHttp() throws Exception {
public void loaderClassesAreNotAvailableViaHttp() {
ResponseEntity<String> entity = this.rest.getForEntity(
"/org/springframework/boot/loader/Launcher.class", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment