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 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......
......@@ -19,7 +19,9 @@ package sample.quartz;
import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.context.ConfigurableApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
......@@ -35,9 +37,11 @@ public class SampleQuartzApplicationTests {
@Test
public void test() {
SampleQuartzApplication.main(new String[0]);
String output = this.outputCapture.toString();
assertThat(output).contains("Hello World!");
try (ConfigurableApplicationContext context = SpringApplication.run(
SampleQuartzApplication.class)) {
String output = this.outputCapture.toString();
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