Polish "Add Log Output when DevTools restart is disabled"
Closes gh-14807
This commit is contained in:
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -27,6 +28,7 @@ import org.springframework.boot.context.event.ApplicationFailedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationPreparedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.boot.context.event.ApplicationStartingEvent;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
@@ -47,6 +49,9 @@ public class RestartApplicationListenerTests {
|
||||
|
||||
private static final String[] ARGS = new String[] { "a", "b", "c" };
|
||||
|
||||
@Rule
|
||||
public final OutputCapture output = new OutputCapture();
|
||||
|
||||
@Before
|
||||
@After
|
||||
public void cleanup() {
|
||||
@@ -81,8 +86,11 @@ public class RestartApplicationListenerTests {
|
||||
@Test
|
||||
public void disableWithSystemProperty() {
|
||||
System.setProperty(ENABLED_PROPERTY, "false");
|
||||
this.output.reset();
|
||||
testInitialize(false);
|
||||
assertThat(Restarter.getInstance()).hasFieldOrPropertyWithValue("enabled", false);
|
||||
assertThat(this.output.toString())
|
||||
.contains("Restart disabled due to System property");
|
||||
}
|
||||
|
||||
private void testInitialize(boolean failed) {
|
||||
|
||||
Reference in New Issue
Block a user