diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java index 6c75c3a118..978ce36078 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java @@ -91,7 +91,7 @@ public abstract class AbstractBootArchiveTests { public void basicArchiveCreation() throws IOException { this.task.setMainClassName("com.example.Main"); this.task.execute(); - assertThat(this.task.getArchivePath().exists()); + assertThat(this.task.getArchivePath()).exists(); try (JarFile jarFile = new JarFile(this.task.getArchivePath())) { assertThat(jarFile.getManifest().getMainAttributes().getValue("Main-Class")) .isEqualTo(this.launcherClass); @@ -226,7 +226,7 @@ public abstract class AbstractBootArchiveTests { this.task.getManifest().getAttributes().put("Main-Class", "com.example.CustomLauncher"); this.task.execute(); - assertThat(this.task.getArchivePath().exists()); + assertThat(this.task.getArchivePath()).exists(); try (JarFile jarFile = new JarFile(this.task.getArchivePath())) { assertThat(jarFile.getManifest().getMainAttributes().getValue("Main-Class")) .isEqualTo("com.example.CustomLauncher"); @@ -244,7 +244,7 @@ public abstract class AbstractBootArchiveTests { this.task.getManifest().getAttributes().put("Start-Class", "com.example.CustomMain"); this.task.execute(); - assertThat(this.task.getArchivePath().exists()); + assertThat(this.task.getArchivePath()).exists(); try (JarFile jarFile = new JarFile(this.task.getArchivePath())) { assertThat(jarFile.getManifest().getMainAttributes().getValue("Main-Class")) .isEqualTo(this.launcherClass); @@ -258,7 +258,7 @@ public abstract class AbstractBootArchiveTests { this.task.setMainClassName("com.example.Main"); this.task.setPreserveFileTimestamps(false); this.task.execute(); - assertThat(this.task.getArchivePath().exists()); + assertThat(this.task.getArchivePath()).exists(); try (JarFile jarFile = new JarFile(this.task.getArchivePath())) { Enumeration entries = jarFile.entries(); while (entries.hasMoreElements()) { @@ -276,7 +276,7 @@ public abstract class AbstractBootArchiveTests { this.temp.newFile("charlie.txt")); this.task.setReproducibleFileOrder(true); this.task.execute(); - assertThat(this.task.getArchivePath().exists()); + assertThat(this.task.getArchivePath()).exists(); List textFiles = new ArrayList<>(); try (JarFile jarFile = new JarFile(this.task.getArchivePath())) { Enumeration entries = jarFile.entries(); @@ -295,7 +295,7 @@ public abstract class AbstractBootArchiveTests { this.task.setMainClassName("com.example.Main"); this.task.classpath(this.temp.newFile("spring-boot-devtools-0.1.2.jar")); this.task.execute(); - assertThat(this.task.getArchivePath().exists()); + assertThat(this.task.getArchivePath()).exists(); try (JarFile jarFile = new JarFile(this.task.getArchivePath())) { assertThat(jarFile.getEntry(this.libPath + "/spring-boot-devtools-0.1.2.jar")) .isNull(); @@ -308,7 +308,7 @@ public abstract class AbstractBootArchiveTests { this.task.classpath(this.temp.newFile("spring-boot-devtools-0.1.2.jar")); this.task.setExcludeDevtools(false); this.task.execute(); - assertThat(this.task.getArchivePath().exists()); + assertThat(this.task.getArchivePath()).exists(); try (JarFile jarFile = new JarFile(this.task.getArchivePath())) { assertThat(jarFile.getEntry(this.libPath + "/spring-boot-devtools-0.1.2.jar")) .isNotNull(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java index c9592e3be5..bc97dbfabf 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootWarTests.java @@ -54,7 +54,7 @@ public class BootWarTests extends AbstractBootArchiveTests { getTask().setMainClassName("com.example.Main"); getTask().providedClasspath(this.temp.newFile("spring-boot-devtools-0.1.2.jar")); getTask().execute(); - assertThat(getTask().getArchivePath().exists()); + assertThat(getTask().getArchivePath()).exists(); try (JarFile jarFile = new JarFile(getTask().getArchivePath())) { assertThat(jarFile .getEntry("WEB-INF/lib-provided/spring-boot-devtools-0.1.2.jar")) @@ -69,7 +69,7 @@ public class BootWarTests extends AbstractBootArchiveTests { getTask().providedClasspath(this.temp.newFile("spring-boot-devtools-0.1.2.jar")); getTask().setExcludeDevtools(false); getTask().execute(); - assertThat(getTask().getArchivePath().exists()); + assertThat(getTask().getArchivePath()).exists(); try (JarFile jarFile = new JarFile(getTask().getArchivePath())) { assertThat(jarFile .getEntry("WEB-INF/lib-provided/spring-boot-devtools-0.1.2.jar")) @@ -87,7 +87,7 @@ public class BootWarTests extends AbstractBootArchiveTests { getTask().from(webappFolder); getTask().setMainClassName("com.example.Main"); getTask().execute(); - assertThat(getTask().getArchivePath().exists()); + assertThat(getTask().getArchivePath()).exists(); try (JarFile jarFile = new JarFile(getTask().getArchivePath())) { assertThat(jarFile.getEntry("org/")).isNotNull(); assertThat(jarFile.getEntry("org/foo.txt")).isNotNull(); diff --git a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerTests.java b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerTests.java index a02be487c9..1c8697828e 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerTests.java +++ b/spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerTests.java @@ -32,7 +32,6 @@ import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; -import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.containsString; import static org.mockito.BDDMockito.given; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -103,7 +102,7 @@ public class UserVehicleControllerTests { @Test(expected = NoSuchBeanDefinitionException.class) public void welcomeCommandLineRunnerShouldBeAvailable() { // Since we're a @WebMvcTest WelcomeCommandLineRunner should not be available. - assertThat(this.applicationContext.getBean(WelcomeCommandLineRunner.class)); + this.applicationContext.getBean(WelcomeCommandLineRunner.class); } }