Merge pull request #19294

* gh-19294:
  Reduce visibility of test methods

Closes gh-19294
See gh-19287
pull/19328/head
Andy Wilkinson 5 years ago
commit dc8edde0fc

@ -32,11 +32,11 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Andy Wilkinson
*/
public class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void addARequestMappingToAnExistingController(ApplicationLauncher applicationLauncher) throws Exception {
void addARequestMappingToAnExistingController(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
@ -51,8 +51,7 @@ public class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void removeARequestMappingFromAnExistingController(ApplicationLauncher applicationLauncher)
throws Exception {
void removeARequestMappingFromAnExistingController(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
@ -65,7 +64,7 @@ public class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void createAController(ApplicationLauncher applicationLauncher) throws Exception {
void createAController(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
@ -81,7 +80,7 @@ public class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void createAControllerAndThenAddARequestMapping(ApplicationLauncher applicationLauncher) throws Exception {
void createAControllerAndThenAddARequestMapping(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
@ -99,8 +98,8 @@ public class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void createAControllerAndThenAddARequestMappingToAnExistingController(
ApplicationLauncher applicationLauncher) throws Exception {
void createAControllerAndThenAddARequestMappingToAnExistingController(ApplicationLauncher applicationLauncher)
throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
@ -120,7 +119,7 @@ public class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void deleteAController(ApplicationLauncher applicationLauncher) throws Exception {
void deleteAController(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();
@ -135,7 +134,7 @@ public class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void createAControllerAndThenDeleteIt(ApplicationLauncher applicationLauncher) throws Exception {
void createAControllerAndThenDeleteIt(ApplicationLauncher applicationLauncher) throws Exception {
launchApplication(applicationLauncher);
TestRestTemplate template = new TestRestTemplate();
String urlBase = "http://localhost:" + awaitServerPort();

@ -31,11 +31,11 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Madhura Bhave
*/
public class DevToolsWithLazyInitializationIntegrationTests extends AbstractDevToolsIntegrationTests {
class DevToolsWithLazyInitializationIntegrationTests extends AbstractDevToolsIntegrationTests {
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
public void addARequestMappingToAnExistingControllerWhenLazyInit(ApplicationLauncher applicationLauncher)
void addARequestMappingToAnExistingControllerWhenLazyInit(ApplicationLauncher applicationLauncher)
throws Exception {
launchApplication(applicationLauncher, "--spring.main.lazy-initialization=true");
TestRestTemplate template = new TestRestTemplate();

@ -61,7 +61,7 @@ import static org.hamcrest.Matchers.containsString;
* @author Andy Wilkinson
* @author Ali Shahbour
*/
public class SysVinitLaunchScriptIT {
class SysVinitLaunchScriptIT {
private final SpringBootDockerCmdExecFactory commandExecFactory = new SpringBootDockerCmdExecFactory();
@ -69,7 +69,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void statusWhenStopped(String os, String version) throws Exception {
void statusWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "status-when-stopped.sh");
assertThat(output).contains("Status: 3");
assertThat(output).has(coloredString(AnsiColor.RED, "Not running"));
@ -77,7 +77,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void statusWhenStarted(String os, String version) throws Exception {
void statusWhenStarted(String os, String version) throws Exception {
String output = doTest(os, version, "status-when-started.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.GREEN, "Started [" + extractPid(output) + "]"));
@ -85,7 +85,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void statusWhenKilled(String os, String version) throws Exception {
void statusWhenKilled(String os, String version) throws Exception {
String output = doTest(os, version, "status-when-killed.sh");
assertThat(output).contains("Status: 1");
assertThat(output)
@ -94,7 +94,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void stopWhenStopped(String os, String version) throws Exception {
void stopWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "stop-when-stopped.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
@ -102,7 +102,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void forceStopWhenStopped(String os, String version) throws Exception {
void forceStopWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "force-stop-when-stopped.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
@ -110,7 +110,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void startWhenStarted(String os, String version) throws Exception {
void startWhenStarted(String os, String version) throws Exception {
String output = doTest(os, version, "start-when-started.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.YELLOW, "Already running [" + extractPid(output) + "]"));
@ -118,7 +118,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void restartWhenStopped(String os, String version) throws Exception {
void restartWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "restart-when-stopped.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
@ -127,7 +127,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void restartWhenStarted(String os, String version) throws Exception {
void restartWhenStarted(String os, String version) throws Exception {
String output = doTest(os, version, "restart-when-started.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.GREEN, "Started [" + extract("PID1", output) + "]"));
@ -137,7 +137,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void startWhenStopped(String os, String version) throws Exception {
void startWhenStopped(String os, String version) throws Exception {
String output = doTest(os, version, "start-when-stopped.sh");
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.GREEN, "Started [" + extractPid(output) + "]"));
@ -145,14 +145,14 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void basicLaunch(String os, String version) throws Exception {
void basicLaunch(String os, String version) throws Exception {
String output = doTest(os, version, "basic-launch.sh");
assertThat(output).doesNotContain("PID_FOLDER");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMissingLogFolderGeneratesAWarning(String os, String version) throws Exception {
void launchWithMissingLogFolderGeneratesAWarning(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-missing-log-folder.sh");
assertThat(output).has(
coloredString(AnsiColor.YELLOW, "LOG_FOLDER /does/not/exist does not exist. Falling back to /tmp"));
@ -160,7 +160,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMissingPidFolderGeneratesAWarning(String os, String version) throws Exception {
void launchWithMissingPidFolderGeneratesAWarning(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-missing-pid-folder.sh");
assertThat(output).has(
coloredString(AnsiColor.YELLOW, "PID_FOLDER /does/not/exist does not exist. Falling back to /tmp"));
@ -168,49 +168,49 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithSingleCommandLineArgument(String os, String version) throws Exception {
void launchWithSingleCommandLineArgument(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-single-command-line-argument.sh");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMultipleCommandLineArguments(String os, String version) throws Exception {
void launchWithMultipleCommandLineArguments(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-multiple-command-line-arguments.sh");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithSingleRunArg(String os, String version) throws Exception {
void launchWithSingleRunArg(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-single-run-arg.sh");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMultipleRunArgs(String os, String version) throws Exception {
void launchWithMultipleRunArgs(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-multiple-run-args.sh");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithSingleJavaOpt(String os, String version) throws Exception {
void launchWithSingleJavaOpt(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-single-java-opt.sh");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithDoubleLinkSingleJavaOpt(String os, String version) throws Exception {
void launchWithDoubleLinkSingleJavaOpt(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-double-link-single-java-opt.sh");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithMultipleJavaOpts(String os, String version) throws Exception {
void launchWithMultipleJavaOpts(String os, String version) throws Exception {
doLaunch(os, version, "launch-with-multiple-java-opts.sh");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithUseOfStartStopDaemonDisabled(String os, String version) throws Exception {
void launchWithUseOfStartStopDaemonDisabled(String os, String version) throws Exception {
// CentOS doesn't have start-stop-daemon
Assumptions.assumeFalse(os.equals("CentOS"));
doLaunch(os, version, "launch-with-use-of-start-stop-daemon-disabled.sh");
@ -218,7 +218,7 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithRelativePidFolder(String os, String version) throws Exception {
void launchWithRelativePidFolder(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-relative-pid-folder.sh");
assertThat(output).has(coloredString(AnsiColor.GREEN, "Started [" + extractPid(output) + "]"));
assertThat(output).has(coloredString(AnsiColor.GREEN, "Running [" + extractPid(output) + "]"));
@ -227,56 +227,56 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void pidFolderOwnership(String os, String version) throws Exception {
void pidFolderOwnership(String os, String version) throws Exception {
String output = doTest(os, version, "pid-folder-ownership.sh");
assertThat(output).contains("phil root");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void pidFileOwnership(String os, String version) throws Exception {
void pidFileOwnership(String os, String version) throws Exception {
String output = doTest(os, version, "pid-file-ownership.sh");
assertThat(output).contains("phil root");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void logFileOwnership(String os, String version) throws Exception {
void logFileOwnership(String os, String version) throws Exception {
String output = doTest(os, version, "log-file-ownership.sh");
assertThat(output).contains("phil root");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void logFileOwnershipIsChangedWhenCreated(String os, String version) throws Exception {
void logFileOwnershipIsChangedWhenCreated(String os, String version) throws Exception {
String output = doTest(os, version, "log-file-ownership-is-changed-when-created.sh");
assertThat(output).contains("andy root");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void logFileOwnershipIsUnchangedWhenExists(String os, String version) throws Exception {
void logFileOwnershipIsUnchangedWhenExists(String os, String version) throws Exception {
String output = doTest(os, version, "log-file-ownership-is-unchanged-when-exists.sh");
assertThat(output).contains("root root");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithRelativeLogFolder(String os, String version) throws Exception {
void launchWithRelativeLogFolder(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-relative-log-folder.sh");
assertThat(output).contains("Log written");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void launchWithRunAsUser(String os, String version) throws Exception {
void launchWithRunAsUser(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-run-as-user.sh");
assertThat(output).contains("wagner root");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void whenRunAsUserDoesNotExistLaunchFailsWithInvalidArgument(String os, String version) throws Exception {
void whenRunAsUserDoesNotExistLaunchFailsWithInvalidArgument(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-run-as-invalid-user.sh");
assertThat(output).contains("Status: 2");
assertThat(output).has(coloredString(AnsiColor.RED, "Cannot run as 'johndoe': no such user"));
@ -284,15 +284,14 @@ public class SysVinitLaunchScriptIT {
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void whenJarOwnerAndRunAsUserAreBothSpecifiedRunAsUserTakesPrecedence(String os, String version)
throws Exception {
void whenJarOwnerAndRunAsUserAreBothSpecifiedRunAsUserTakesPrecedence(String os, String version) throws Exception {
String output = doTest(os, version, "launch-with-run-as-user-preferred-to-jar-owner.sh");
assertThat(output).contains("wagner root");
}
@ParameterizedTest(name = "{0} {1}")
@MethodSource("parameters")
public void whenLaunchedUsingNonRootUserWithRunAsUserSpecifiedLaunchFailsWithInsufficientPrivilege(String os,
void whenLaunchedUsingNonRootUserWithRunAsUserSpecifiedLaunchFailsWithInsufficientPrivilege(String os,
String version) throws Exception {
String output = doTest(os, version, "launch-with-run-as-user-root-required.sh");
assertThat(output).contains("Status: 4");

@ -34,18 +34,17 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@EmbeddedServletContainerTest(packaging = "jar",
launchers = { BootRunApplicationLauncher.class, IdeApplicationLauncher.class })
public class EmbeddedServletContainerJarDevelopmentIntegrationTests {
class EmbeddedServletContainerJarDevelopmentIntegrationTests {
@TestTemplate
public void metaInfResourceFromDependencyIsAvailableViaHttp(RestTemplate rest) {
void metaInfResourceFromDependencyIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@TestTemplate
@DisabledOnOs(OS.WINDOWS)
public void metaInfResourceFromDependencyWithNameThatContainsReservedCharactersIsAvailableViaHttp(
RestTemplate rest) {
void metaInfResourceFromDependencyWithNameThatContainsReservedCharactersIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity(
"/nested-reserved-%21%23%24%25%26%28%29%2A%2B%2C%3A%3D%3F%40%5B%5D-meta-inf-resource.txt",
String.class);
@ -54,7 +53,7 @@ public class EmbeddedServletContainerJarDevelopmentIntegrationTests {
}
@TestTemplate
public void metaInfResourceFromDependencyIsAvailableViaServletContext(RestTemplate rest) {
void metaInfResourceFromDependencyIsAvailableViaServletContext(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/servletContext?/nested-meta-inf-resource.txt",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);

@ -34,17 +34,17 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@EmbeddedServletContainerTest(packaging = "jar",
launchers = { PackagedApplicationLauncher.class, ExplodedApplicationLauncher.class })
public class EmbeddedServletContainerJarPackagingIntegrationTests {
class EmbeddedServletContainerJarPackagingIntegrationTests {
@TestTemplate
public void nestedMetaInfResourceIsAvailableViaHttp(RestTemplate rest) {
void nestedMetaInfResourceIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@TestTemplate
@DisabledOnOs(OS.WINDOWS)
public void nestedMetaInfResourceWithNameThatContainsReservedCharactersIsAvailableViaHttp(RestTemplate rest) {
void nestedMetaInfResourceWithNameThatContainsReservedCharactersIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity(
"/nested-reserved-%21%23%24%25%26%28%29%2A%2B%2C%3A%3D%3F%40%5B%5D-meta-inf-resource.txt",
String.class);
@ -53,27 +53,27 @@ public class EmbeddedServletContainerJarPackagingIntegrationTests {
}
@TestTemplate
public void nestedMetaInfResourceIsAvailableViaServletContext(RestTemplate rest) {
void nestedMetaInfResourceIsAvailableViaServletContext(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/servletContext?/nested-meta-inf-resource.txt",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@TestTemplate
public void nestedJarIsNotAvailableViaHttp(RestTemplate rest) {
void nestedJarIsNotAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/BOOT-INF/lib/resources-1.0.jar", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}
@TestTemplate
public void applicationClassesAreNotAvailableViaHttp(RestTemplate rest) {
void applicationClassesAreNotAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest
.getForEntity("/BOOT-INF/classes/com/example/ResourceHandlingApplication.class", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}
@TestTemplate
public void launcherIsNotAvailableViaHttp(RestTemplate rest) {
void launcherIsNotAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/org/springframework/boot/loader/Launcher.class",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);

@ -41,18 +41,17 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@EmbeddedServletContainerTest(packaging = "war",
launchers = { BootRunApplicationLauncher.class, IdeApplicationLauncher.class })
public class EmbeddedServletContainerWarDevelopmentIntegrationTests {
class EmbeddedServletContainerWarDevelopmentIntegrationTests {
@TestTemplate
public void metaInfResourceFromDependencyIsAvailableViaHttp(RestTemplate rest) {
void metaInfResourceFromDependencyIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@TestTemplate
@DisabledOnOs(OS.WINDOWS)
public void metaInfResourceFromDependencyWithNameThatContainsReservedCharactersIsAvailableViaHttp(
RestTemplate rest) {
void metaInfResourceFromDependencyWithNameThatContainsReservedCharactersIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity(
"/nested-reserved-%21%23%24%25%26%28%29%2A%2B%2C%3A%3D%3F%40%5B%5D-meta-inf-resource.txt",
String.class);
@ -61,20 +60,20 @@ public class EmbeddedServletContainerWarDevelopmentIntegrationTests {
}
@TestTemplate
public void metaInfResourceFromDependencyIsAvailableViaServletContext(RestTemplate rest) {
void metaInfResourceFromDependencyIsAvailableViaServletContext(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/servletContext?/nested-meta-inf-resource.txt",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@TestTemplate
public void webappResourcesAreAvailableViaHttp(RestTemplate rest) {
void webappResourcesAreAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/webapp-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@TestTemplate
public void loaderClassesAreNotAvailableViaResourcePaths(RestTemplate rest) {
void loaderClassesAreNotAvailableViaResourcePaths(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/resourcePaths", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(readLines(entity.getBody()))

@ -41,17 +41,17 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@EmbeddedServletContainerTest(packaging = "war",
launchers = { PackagedApplicationLauncher.class, ExplodedApplicationLauncher.class })
public class EmbeddedServletContainerWarPackagingIntegrationTests {
class EmbeddedServletContainerWarPackagingIntegrationTests {
@TestTemplate
public void nestedMetaInfResourceIsAvailableViaHttp(RestTemplate rest) {
void nestedMetaInfResourceIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/nested-meta-inf-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@TestTemplate
@DisabledOnOs(OS.WINDOWS)
public void nestedMetaInfResourceWithNameThatContainsReservedCharactersIsAvailableViaHttp(RestTemplate rest) {
void nestedMetaInfResourceWithNameThatContainsReservedCharactersIsAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity(
"/nested-reserved-%21%23%24%25%26%28%29%2A%2B%2C%3A%3D%3F%40%5B%5D-meta-inf-resource.txt",
String.class);
@ -60,33 +60,33 @@ public class EmbeddedServletContainerWarPackagingIntegrationTests {
}
@TestTemplate
public void nestedMetaInfResourceIsAvailableViaServletContext(RestTemplate rest) {
void nestedMetaInfResourceIsAvailableViaServletContext(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/servletContext?/nested-meta-inf-resource.txt",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@TestTemplate
public void nestedJarIsNotAvailableViaHttp(RestTemplate rest) {
void nestedJarIsNotAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/WEB-INF/lib/resources-1.0.jar", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}
@TestTemplate
public void applicationClassesAreNotAvailableViaHttp(RestTemplate rest) {
void applicationClassesAreNotAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest
.getForEntity("/WEB-INF/classes/com/example/ResourceHandlingApplication.class", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}
@TestTemplate
public void webappResourcesAreAvailableViaHttp(RestTemplate rest) {
void webappResourcesAreAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/webapp-resource.txt", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
}
@TestTemplate
public void loaderClassesAreNotAvailableViaHttp(RestTemplate rest) {
void loaderClassesAreNotAvailableViaHttp(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/org/springframework/boot/loader/Launcher.class",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
@ -95,7 +95,7 @@ public class EmbeddedServletContainerWarPackagingIntegrationTests {
}
@TestTemplate
public void loaderClassesAreNotAvailableViaResourcePaths(RestTemplate rest) {
void loaderClassesAreNotAvailableViaResourcePaths(RestTemplate rest) {
ResponseEntity<String> entity = rest.getForEntity("/resourcePaths", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(readLines(entity.getBody()))

Loading…
Cancel
Save