Do not rely on test runner using static main method in RestarterTests

Closes gh-15461
pull/15465/head
Andy Wilkinson 6 years ago
parent 62fbf48446
commit db5ab1d14c

@ -62,7 +62,7 @@ public class RestarterTests {
@Before
public void setup() {
Restarter.setInstance(new TestableRestarter());
RestarterInitializer.setRestarterInstance();
}
@After
@ -176,6 +176,13 @@ public class RestarterTests {
assertThat(Restarter.getInstance().getInitialUrls()).isEqualTo(urls);
}
@FunctionalInterface
private interface WithMainAction {
void perform() throws Exception;
}
@Component
@EnableScheduling
public static class SampleApplication {
@ -272,4 +279,16 @@ public class RestarterTests {
}
static class RestarterInitializer {
static void setRestarterInstance() {
main(new String[0]);
}
static void main(String[] args) {
Restarter.setInstance(new TestableRestarter());
}
}
}

Loading…
Cancel
Save