Automatically disable DevTools when running a Cucumber test

Closes gh-6412
This commit is contained in:
Andy Wilkinson 2016-07-19 09:50:56 +01:00
parent e9c69f261d
commit a6f443a953
2 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import java.util.Set;
* exploded) or when running from a test.
*
* @author Phillip Webb
* @author Andy Wilkinson
* @since 1.3.0
*/
public class DefaultRestartInitializer implements RestartInitializer {
@ -38,6 +39,7 @@ public class DefaultRestartInitializer implements RestartInitializer {
Set<String> skipped = new LinkedHashSet<String>();
skipped.add("org.junit.runners.");
skipped.add("org.springframework.boot.test.");
skipped.add("cucumber.runtime.");
SKIPPED_STACK_ELEMENTS = Collections.unmodifiableSet(skipped);
}

View File

@ -27,6 +27,7 @@ import static org.hamcrest.Matchers.nullValue;
* Tests for {@link DefaultRestartInitializer}.
*
* @author Phillip Webb
* @author Andy Wilkinson
*/
public class DefaultRestartInitializerTests {
@ -80,6 +81,11 @@ public class DefaultRestartInitializerTests {
testSkipStack("org.springframework.boot.test.Something", true);
}
@Test
public void skipsDueToCucumber() throws Exception {
testSkipStack("cucumber.runtime.Runtime.run", true);
}
private void testSkipStack(String className, boolean expected) {
MockRestartInitializer initializer = new MockRestartInitializer(true);
StackTraceElement element = new StackTraceElement(className, "someMethod",