Use AssertJ in spring-boot-samples

See gh-5083
This commit is contained in:
Phillip Webb
2016-02-06 14:53:10 -08:00
parent 962a598531
commit 1cc1fc6431
97 changed files with 580 additions and 733 deletions

View File

@@ -24,7 +24,7 @@ import org.junit.Test;
import org.springframework.boot.test.OutputCapture;
import org.springframework.core.NestedCheckedException;
import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;
public class SampleLiquibaseApplicationTests {
@@ -42,23 +42,22 @@ public class SampleLiquibaseApplicationTests {
}
}
String output = this.outputCapture.toString();
assertTrue("Wrong output: " + output,
output.contains("Successfully acquired change log lock")
&& output.contains("Creating database history "
+ "table with name: PUBLIC.DATABASECHANGELOG")
&& output.contains("Table person created")
&& output.contains("ChangeSet classpath:/db/"
assertThat(output).contains("Successfully acquired change log lock")
.contains("Creating database history "
+ "table with name: PUBLIC.DATABASECHANGELOG")
.contains("Table person created")
.contains("ChangeSet classpath:/db/"
+ "changelog/db.changelog-master.yaml::1::"
+ "marceloverdijk ran successfully")
&& output.contains("New row inserted into person")
&& output.contains("ChangeSet classpath:/db/changelog/"
.contains("New row inserted into person")
.contains("ChangeSet classpath:/db/changelog/"
+ "db.changelog-master.yaml::2::"
+ "marceloverdijk ran successfully")
&& output.contains("Successfully released change log lock"));
.contains("Successfully released change log lock");
}
@SuppressWarnings("serial")
private boolean serverNotRunning(IllegalStateException ex) {
@SuppressWarnings("serial")
NestedCheckedException nested = new NestedCheckedException("failed", ex) {
};
if (nested.contains(ConnectException.class)) {