Commit 80940764 authored by Andy Wilkinson's avatar Andy Wilkinson

Do not trigger a restart when a test class is changed

Previously, dev tools would restart the application when any .class
file changed. This included test classes. This commit updates the
default excludes to ignore any classes with a name that ends in 
Test.class or Tests.class.

Closes gh-3900
parent c3e447c8
......@@ -59,7 +59,8 @@ public class DevToolsProperties {
public static class Restart {
private static final String DEFAULT_RESTART_EXCLUDES = "META-INF/maven/**,"
+ "META-INF/resources/**,resources/**,static/**,public/**,templates/**";
+ "META-INF/resources/**,resources/**,static/**,public/**,templates/**,"
+ "**/*Test.class,**/*Tests.class";
private static final long DEFAULT_RESTART_POLL_INTERVAL = 1000;
......
......@@ -74,6 +74,14 @@ public class PatternClassPathRestartStrategyTests {
assertRestartRequired(strategy, mavenFolder + "/pom.properties", false);
}
@Test
public void testChange() {
ClassPathRestartStrategy strategy = createStrategy("**/*Test.class,**/*Tests.class");
assertRestartRequired(strategy, "com/example/ExampleTests.class", false);
assertRestartRequired(strategy, "com/example/ExampleTest.class", false);
assertRestartRequired(strategy, "com/example/Example.class", true);
}
private ClassPathRestartStrategy createStrategy(String pattern) {
return new PatternClassPathRestartStrategy(pattern);
}
......
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