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

Remove redundant throws declarations

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