Commit 51f0d88e authored by Stephane Nicoll's avatar Stephane Nicoll

Polish "Add test to spring-boot-sample-quartz"

Closes gh-11621
parent 5f1f04a3
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId> <artifactId>spring-boot-starter-quartz</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
......
...@@ -19,7 +19,9 @@ package sample.quartz; ...@@ -19,7 +19,9 @@ package sample.quartz;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.rule.OutputCapture; import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.context.ConfigurableApplicationContext;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
...@@ -35,9 +37,11 @@ public class SampleQuartzApplicationTests { ...@@ -35,9 +37,11 @@ public class SampleQuartzApplicationTests {
@Test @Test
public void test() { public void test() {
SampleQuartzApplication.main(new String[0]); try (ConfigurableApplicationContext context = SpringApplication.run(
SampleQuartzApplication.class)) {
String output = this.outputCapture.toString(); String output = this.outputCapture.toString();
assertThat(output).contains("Hello World!"); assertThat(output).contains("Hello World!");
} }
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment