Use AssertJ in spring-boot-integration-tests

See gh-5083
This commit is contained in:
Phillip Webb 2016-02-06 15:09:40 -08:00
parent 1cc1fc6431
commit e214fa0949
11 changed files with 110 additions and 118 deletions

View File

@ -25,8 +25,7 @@ import org.junit.Test;
import org.springframework.boot.test.OutputCapture;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for bootRun's resource handling
@ -53,7 +52,7 @@ public class BootRunResourceTests {
.withArguments("-PbootVersion=" + BOOT_VERSION, "-PaddResources=true")
.run();
assertThat(this.output.toString(), containsString("src/main/resources/test.txt"));
assertThat(this.output.toString()).contains("src/main/resources/test.txt");
}
@Test
@ -61,8 +60,7 @@ public class BootRunResourceTests {
project.newBuild().forTasks("clean", "bootRun")
.withArguments("-PbootVersion=" + BOOT_VERSION, "-PaddResources=false")
.run();
assertThat(this.output.toString(),
containsString("build/resources/main/test.txt"));
assertThat(this.output.toString()).contains("build/resources/main/test.txt");
}
}

View File

@ -21,7 +21,7 @@ import java.util.jar.JarFile;
import org.gradle.tooling.ProjectConnection;
import org.junit.Test;
import static org.junit.Assert.assertNotNull;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for using the Gradle plugin's support for installing artifacts
@ -52,10 +52,10 @@ public class ClassifierTests {
private void checkFilesExist(String name) throws Exception {
JarFile jar = new JarFile("target/" + name + "/build/libs/" + name + ".jar");
assertNotNull(jar.getManifest());
assertThat(jar.getManifest()).isNotNull();
jar.close();
jar = new JarFile("target/" + name + "/build/libs/" + name + "-exec.jar");
assertNotNull(jar.getManifest());
assertThat(jar.getManifest()).isNotNull();
jar.close();
}

View File

@ -28,8 +28,7 @@ import org.gradle.tooling.ProjectConnection;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for creating a fully executable jar with Gradle.
@ -53,7 +52,7 @@ public class FullyExecutableJarTests {
.withArguments("-PbootVersion=" + BOOT_VERSION).run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(isFullyExecutable(executableJar), is(false));
assertThat(isFullyExecutable(executableJar)).isFalse();
}
@Test
@ -62,7 +61,7 @@ public class FullyExecutableJarTests {
"-PbootVersion=" + BOOT_VERSION, "-PextensionExecutable=true").run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(isFullyExecutable(executableJar), is(true));
assertThat(isFullyExecutable(executableJar)).isTrue();
}
@Test
@ -72,7 +71,7 @@ public class FullyExecutableJarTests {
.run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(isFullyExecutable(executableJar), is(true));
assertThat(isFullyExecutable(executableJar)).isTrue();
}
@Test
@ -83,7 +82,7 @@ public class FullyExecutableJarTests {
.run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(isFullyExecutable(executableJar), is(true));
assertThat(isFullyExecutable(executableJar)).isTrue();
}
@Test
@ -93,8 +92,8 @@ public class FullyExecutableJarTests {
.run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(isFullyExecutable(executableJar), is(true));
assertThat(containsLine("# Provides:.*__task__", executableJar), is(true));
assertThat(isFullyExecutable(executableJar)).isTrue();
assertThat(containsLine("# Provides:.*__task__", executableJar)).isTrue();
}
@Test
@ -103,8 +102,8 @@ public class FullyExecutableJarTests {
"-PbootVersion=" + BOOT_VERSION, "-PextensionProperties=true").run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(isFullyExecutable(executableJar), is(true));
assertThat(containsLine("# Provides:.*__extension__", executableJar), is(true));
assertThat(isFullyExecutable(executableJar)).isTrue();
assertThat(containsLine("# Provides:.*__extension__", executableJar)).isTrue();
}
@Test
@ -115,8 +114,8 @@ public class FullyExecutableJarTests {
.run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(isFullyExecutable(executableJar), is(true));
assertThat(containsLine("# Provides:.*__task__", executableJar), is(true));
assertThat(isFullyExecutable(executableJar)).isTrue();
assertThat(containsLine("# Provides:.*__task__", executableJar)).isTrue();
}
@Test
@ -126,7 +125,7 @@ public class FullyExecutableJarTests {
.run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(containsLine("Custom task script", executableJar), is(true));
assertThat(containsLine("Custom task script", executableJar)).isTrue();
}
@Test
@ -136,7 +135,7 @@ public class FullyExecutableJarTests {
.run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(containsLine("Custom extension script", executableJar), is(true));
assertThat(containsLine("Custom extension script", executableJar)).isTrue();
}
@Test
@ -147,7 +146,7 @@ public class FullyExecutableJarTests {
.run();
File buildLibs = new File("target/executable-jar/build/libs");
File executableJar = new File(buildLibs, "executable-jar.jar");
assertThat(containsLine("Custom task script", executableJar), is(true));
assertThat(containsLine("Custom task script", executableJar)).isTrue();
}
private boolean isFullyExecutable(File file) throws IOException {

View File

@ -22,8 +22,7 @@ import java.util.jar.JarFile;
import org.gradle.tooling.ProjectConnection;
import org.junit.Test;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for Gradle repackaging with a multi-project build.
@ -43,8 +42,8 @@ public class MultiProjectRepackagingTests {
File buildLibs = new File(
"target/multi-project-transitive-file-dependency/main/build/libs");
JarFile jarFile = new JarFile(new File(buildLibs, "main.jar"));
assertThat(jarFile.getEntry("lib/commons-logging-1.1.3.jar"), notNullValue());
assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue());
assertThat(jarFile.getEntry("lib/commons-logging-1.1.3.jar")).isNotNull();
assertThat(jarFile.getEntry("lib/foo.jar")).isNotNull();
jarFile.close();
}
@ -58,7 +57,7 @@ public class MultiProjectRepackagingTests {
"target/multi-project-common-file-dependency/build/libs");
JarFile jarFile = new JarFile(
new File(buildLibs, "multi-project-common-file-dependency.jar"));
assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue());
assertThat(jarFile.getEntry("lib/foo.jar")).isNotNull();
jarFile.close();
}
@ -71,7 +70,7 @@ public class MultiProjectRepackagingTests {
File buildLibs = new File(
"target/multi-project-runtime-project-dependency/projectA/build/libs");
JarFile jarFile = new JarFile(new File(buildLibs, "projectA.jar"));
assertThat(jarFile.getEntry("lib/projectB.jar"), notNullValue());
assertThat(jarFile.getEntry("lib/projectB.jar")).isNotNull();
jarFile.close();
}

View File

@ -21,7 +21,7 @@ import java.io.File;
import org.gradle.tooling.ProjectConnection;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for using the Gradle plugin's support for flat directory repos
@ -39,7 +39,7 @@ public class NoJarTests {
this.project = new ProjectCreator().createProject("nojar");
this.project.newBuild().forTasks("build")
.withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run();
assertFalse(new File("target/nojar/build/libs").exists());
assertThat(new File("target/nojar/build/libs")).doesNotExist();
}
}

View File

@ -62,4 +62,5 @@ public class ProjectCreator {
((DefaultGradleConnector) gradleConnector).embedded(true);
return gradleConnector.forProjectDirectory(projectDirectory).connect();
}
}

View File

@ -26,10 +26,7 @@ import org.junit.Test;
import org.springframework.util.FileCopyUtils;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for gradle repackaging.
@ -55,10 +52,11 @@ public class RepackagingTests {
.run();
File buildLibs = new File("target/repackage/build/libs");
File repackageFile = new File(buildLibs, "repackage.jar");
assertTrue(repackageFile.exists());
assertTrue(new File(buildLibs, "repackage.jar.original").exists());
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
assertTrue(isDevToolsJarIncluded(repackageFile));
assertThat(repackageFile.exists()).isTrue();
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue();
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
.isFalse();
assertThat(isDevToolsJarIncluded(repackageFile)).isTrue();
}
@Test
@ -68,9 +66,10 @@ public class RepackagingTests {
"-PexcludeDevtools=false")
.run();
File buildLibs = new File("target/repackage/build/libs");
assertTrue(new File(buildLibs, "repackage.jar").exists());
assertFalse(new File(buildLibs, "repackage.jar.original").exists());
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isFalse();
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
.isFalse();
}
@Test
@ -80,11 +79,12 @@ public class RepackagingTests {
"-PexcludeDevtools=false")
.run();
File buildLibs = new File("target/repackage/build/libs");
assertTrue(new File(buildLibs, "repackage.jar").exists());
assertFalse(new File(buildLibs, "repackage.jar.original").exists());
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
assertTrue(new File(buildLibs, "custom.jar").exists());
assertTrue(new File(buildLibs, "custom.jar.original").exists());
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isFalse();
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
.isFalse();
assertThat(new File(buildLibs, "custom.jar").exists()).isTrue();
assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue();
}
@Test
@ -95,11 +95,12 @@ public class RepackagingTests {
"-PexcludeDevtools=false")
.run();
File buildLibs = new File("target/repackage/build/libs");
assertTrue(new File(buildLibs, "repackage.jar").exists());
assertFalse(new File(buildLibs, "repackage.jar.original").exists());
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
assertTrue(new File(buildLibs, "custom.jar").exists());
assertTrue(new File(buildLibs, "custom.jar.original").exists());
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isFalse();
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
.isFalse();
assertThat(new File(buildLibs, "custom.jar").exists()).isTrue();
assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue();
}
@Test
@ -109,11 +110,12 @@ public class RepackagingTests {
"-PexcludeDevtools=false")
.run();
File buildLibs = new File("target/repackage/build/libs");
assertTrue(new File(buildLibs, "repackage.jar").exists());
assertTrue(new File(buildLibs, "repackage.jar.original").exists());
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
assertTrue(new File(buildLibs, "custom.jar").exists());
assertTrue(new File(buildLibs, "custom.jar.original").exists());
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue();
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
.isFalse();
assertThat(new File(buildLibs, "custom.jar").exists()).isTrue();
assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue();
}
@Test
@ -124,11 +126,12 @@ public class RepackagingTests {
"-PexcludeDevtools=false")
.run();
File buildLibs = new File("target/repackage/build/libs");
assertTrue(new File(buildLibs, "repackage.jar").exists());
assertTrue(new File(buildLibs, "repackage.jar.original").exists());
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
assertTrue(new File(buildLibs, "custom.jar").exists());
assertTrue(new File(buildLibs, "custom.jar.original").exists());
assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue();
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue();
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
.isFalse();
assertThat(new File(buildLibs, "custom.jar").exists()).isTrue();
assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue();
}
@Test
@ -141,7 +144,7 @@ public class RepackagingTests {
.run();
File buildLibs = new File("target/repackage/build/libs");
JarFile jarFile = new JarFile(new File(buildLibs, "repackage.jar"));
assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue());
assertThat(jarFile.getEntry("lib/foo.jar")).isNotNull();
jarFile.close();
}
@ -153,10 +156,11 @@ public class RepackagingTests {
.run();
File buildLibs = new File("target/repackage/build/libs");
File repackageFile = new File(buildLibs, "repackage.jar");
assertTrue(repackageFile.exists());
assertTrue(new File(buildLibs, "repackage.jar.original").exists());
assertFalse(new File(buildLibs, "repackage-sources.jar.original").exists());
assertFalse(isDevToolsJarIncluded(repackageFile));
assertThat(repackageFile.exists()).isTrue();
assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue();
assertThat(new File(buildLibs, "repackage-sources.jar.original").exists())
.isFalse();
assertThat(isDevToolsJarIncluded(repackageFile)).isFalse();
}
private boolean isDevToolsJarIncluded(File repackageFile) throws IOException {

View File

@ -62,4 +62,5 @@ public final class Versions {
throw new IllegalStateException("Failed to evaluate expression", ex);
}
}
}

View File

@ -30,8 +30,7 @@ import org.gradle.tooling.ProjectConnection;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for war packaging with Gradle to ensure that only the Servlet container and its
@ -59,8 +58,7 @@ public class WarPackagingTests {
"asm-", "javax.websocket-api-", "asm-tree-", "asm-commons-",
"websocket-common-", "jetty-annotations-",
"javax-websocket-client-impl-", "websocket-client-",
"websocket-server-", "jetty-xml-",
"websocket-servlet-"));
"websocket-server-", "jetty-xml-", "websocket-servlet-"));
private static final String BOOT_VERSION = Versions.getBootVersion();
@ -107,35 +105,26 @@ public class WarPackagingTests {
private void checkWebInfLibProvidedEntries(JarFile war, Set<String> expectedEntries)
throws IOException {
Set<String> entries = getWebInfLibProvidedEntries(war);
assertEquals("Expected " + expectedEntries.size() + " but found " + entries.size()
+ ": " + entries, expectedEntries.size(), entries.size());
assertThat(entries).hasSameSizeAs(expectedEntries);
List<String> unexpectedLibProvidedEntries = new ArrayList<String>();
for (String entry : entries) {
if (!isExpectedInWebInfLibProvided(entry, expectedEntries)) {
unexpectedLibProvidedEntries.add(entry);
}
}
assertTrue(
"Found unexpected entries in WEB-INF/lib-provided: "
+ unexpectedLibProvidedEntries,
unexpectedLibProvidedEntries.isEmpty());
assertThat(unexpectedLibProvidedEntries.isEmpty());
}
private void checkWebInfLibEntries(JarFile war, Set<String> entriesOnlyInLibProvided)
throws IOException {
Set<String> entries = getWebInfLibEntries(war);
List<String> unexpectedLibEntries = new ArrayList<String>();
for (String entry : entries) {
if (!isExpectedInWebInfLib(entry, entriesOnlyInLibProvided)) {
unexpectedLibEntries.add(entry);
}
}
assertTrue("Found unexpected entries in WEB-INF/lib: " + unexpectedLibEntries,
unexpectedLibEntries.isEmpty());
assertThat(unexpectedLibEntries.isEmpty());
}
private Set<String> getWebInfLibProvidedEntries(JarFile war) throws IOException {
@ -189,4 +178,5 @@ public class WarPackagingTests {
}
return true;
}
}

View File

@ -41,18 +41,19 @@ import com.github.dockerjava.core.command.AttachContainerResultCallback;
import com.github.dockerjava.core.command.BuildImageResultCallback;
import com.github.dockerjava.jaxrs.AbstrSyncDockerCmdExec;
import com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl;
import org.hamcrest.Matcher;
import org.assertj.core.api.Condition;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.springframework.boot.ansi.AnsiColor;
import org.springframework.boot.test.assertj.Matched;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeThat;
/**
@ -90,70 +91,70 @@ public class SysVinitLaunchScriptIT {
@Test
public void statusWhenStopped() throws Exception {
String output = doTest("status-when-stopped.sh");
assertThat(output, containsString("Status: 3"));
assertThat(output, containsColoredString(AnsiColor.RED, "Not running"));
assertThat(output).contains("Status: 3");
assertThat(output).has(coloredString(AnsiColor.RED, "Not running"));
}
@Test
public void statusWhenStarted() throws Exception {
String output = doTest("status-when-started.sh");
assertThat(output, containsString("Status: 0"));
assertThat(output, containsColoredString(AnsiColor.GREEN,
"Started [" + extractPid(output) + "]"));
assertThat(output).contains("Status: 0");
assertThat(output).has(
coloredString(AnsiColor.GREEN, "Started [" + extractPid(output) + "]"));
}
@Test
public void statusWhenKilled() throws Exception {
String output = doTest("status-when-killed.sh");
assertThat(output, containsString("Status: 1"));
assertThat(output, containsColoredString(AnsiColor.RED,
assertThat(output).contains("Status: 1");
assertThat(output).has(coloredString(AnsiColor.RED,
"Not running (process " + extractPid(output) + " not found)"));
}
@Test
public void stopWhenStopped() throws Exception {
String output = doTest("stop-when-stopped.sh");
assertThat(output, containsString("Status: 0"));
assertThat(output, containsColoredString(AnsiColor.YELLOW,
"Not running (pidfile not found)"));
assertThat(output).contains("Status: 0");
assertThat(output)
.has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
}
@Test
public void startWhenStarted() throws Exception {
String output = doTest("start-when-started.sh");
assertThat(output, containsString("Status: 0"));
assertThat(output, containsColoredString(AnsiColor.YELLOW,
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.YELLOW,
"Already running [" + extractPid(output) + "]"));
}
@Test
public void restartWhenStopped() throws Exception {
String output = doTest("restart-when-stopped.sh");
assertThat(output, containsString("Status: 0"));
assertThat(output, containsColoredString(AnsiColor.YELLOW,
"Not running (pidfile not found)"));
assertThat(output, containsColoredString(AnsiColor.GREEN,
"Started [" + extractPid(output) + "]"));
assertThat(output).contains("Status: 0");
assertThat(output)
.has(coloredString(AnsiColor.YELLOW, "Not running (pidfile not found)"));
assertThat(output).has(
coloredString(AnsiColor.GREEN, "Started [" + extractPid(output) + "]"));
}
@Test
public void restartWhenStarted() throws Exception {
String output = doTest("restart-when-started.sh");
assertThat(output, containsString("Status: 0"));
assertThat(output, containsColoredString(AnsiColor.GREEN,
assertThat(output).contains("Status: 0");
assertThat(output).has(coloredString(AnsiColor.GREEN,
"Started [" + extract("PID1", output) + "]"));
assertThat(output, containsColoredString(AnsiColor.GREEN,
assertThat(output).has(coloredString(AnsiColor.GREEN,
"Stopped [" + extract("PID1", output) + "]"));
assertThat(output, containsColoredString(AnsiColor.GREEN,
assertThat(output).has(coloredString(AnsiColor.GREEN,
"Started [" + extract("PID2", output) + "]"));
}
@Test
public void startWhenStopped() throws Exception {
String output = doTest("start-when-stopped.sh");
assertThat(output, containsString("Status: 0"));
assertThat(output, containsColoredString(AnsiColor.GREEN,
"Started [" + extractPid(output) + "]"));
assertThat(output).contains("Status: 0");
assertThat(output).has(
coloredString(AnsiColor.GREEN, "Started [" + extractPid(output) + "]"));
}
@Test
@ -199,7 +200,7 @@ public class SysVinitLaunchScriptIT {
}
private void doLaunch(String script) throws Exception {
assertThat(doTest(script), containsString("Launched"));
assertThat(doTest(script)).contains("Launched");
}
private String doTest(String script) throws Exception {
@ -277,8 +278,9 @@ public class SysVinitLaunchScriptIT {
"Could not find test application in target directory. Have you built it (mvn package)?");
}
private Matcher<String> containsColoredString(AnsiColor color, String string) {
return containsString(ESC + "[0;" + color + "m" + string + ESC + "[0m");
private Condition<String> coloredString(AnsiColor color, String string) {
String colorString = ESC + "[0;" + color + "m" + string + ESC + "[0m";
return Matched.by(containsString(colorString));
}
private String extractPid(String output) {

View File

@ -32,8 +32,7 @@ import org.springframework.security.crypto.codec.Base64;
import org.springframework.security.web.FilterChainProxy;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(HelloWebSecurityApplication.class)
@ -59,9 +58,8 @@ public class HelloWebSecurityApplicationTests {
@Test
public void requiresAuthentication() throws Exception {
this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain);
assertThat(this.response.getStatus(),
equalTo(HttpServletResponse.SC_UNAUTHORIZED));
assertThat(this.response.getStatus())
.isEqualTo(HttpServletResponse.SC_UNAUTHORIZED);
}
@Test
@ -71,7 +69,7 @@ public class HelloWebSecurityApplicationTests {
this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain);
assertThat(this.response.getStatus(), equalTo(HttpServletResponse.SC_OK));
assertThat(this.response.getStatus()).isEqualTo(HttpServletResponse.SC_OK);
}
}