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

@@ -16,9 +16,7 @@
package sample.ant;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.io.FileFilter;
@@ -48,12 +46,12 @@ public class SampleAntApplicationIT {
}
});
assertThat("Number of jars", jarFiles.length, equalTo(1));
assertThat(jarFiles).hasSize(1);
Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0].getName()).directory(target).start();
process.waitFor(5, TimeUnit.MINUTES);
assertThat(process.exitValue(), equalTo(0));
assertThat(process.exitValue()).isEqualTo(0);
String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream()));
assertThat(output, containsString("Spring Boot Ant Example"));
assertThat(output).contains("Spring Boot Ant Example");
}
}