diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java index 9e2016e71d0..c98b3f75a20 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/filewatch/FileSystemWatcherTests.java @@ -22,6 +22,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; @@ -51,7 +52,8 @@ public class FileSystemWatcherTests { private FileSystemWatcher watcher; - private List> changes = new ArrayList>(); + private List> changes = Collections + .synchronizedList(new ArrayList>()); @Rule public TemporaryFolder temp = new TemporaryFolder(); @@ -153,11 +155,10 @@ public class FileSystemWatcherTests { @Test public void waitsForPollingInterval() throws Exception { - this.changes.clear(); - setupWatcher(200, 1); + setupWatcher(100, 1); File folder = startWithNewFolder(); touch(new File(folder, "test1.txt")); - Thread.sleep(400); + Thread.sleep(200); touch(new File(folder, "test2.txt")); this.watcher.stopAfter(1); assertThat(this.changes.size()).isEqualTo(2);