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:
parent
c3e447c84c
commit
80940764f6
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue