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
This commit is contained in:
Andy Wilkinson 2015-09-21 16:22:47 +01:00
parent c3e447c84c
commit 80940764f6
2 changed files with 10 additions and 1 deletions

View File

@ -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;

View File

@ -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);
}