This commit is contained in:
Phillip Webb
2016-04-10 21:27:32 -07:00
parent 7709352c2d
commit 6d23ce2ada
2 changed files with 8 additions and 8 deletions

View File

@@ -77,11 +77,17 @@ public class ClassPathFileSystemWatcherTests {
context.getEnvironment().getPropertySources().addLast(propertySource);
context.register(Config.class);
context.refresh();
Thread.sleep(100);
Thread.sleep(200);
File classFile = new File(folder, "Example.class");
FileCopyUtils.copy("file".getBytes(), classFile);
Thread.sleep(1100);
Thread.sleep(1000);
List<ClassPathChangedEvent> events = context.getBean(Listener.class).getEvents();
for (int i = 0; i < 20; i++) {
if (!events.isEmpty()) {
break;
}
Thread.sleep(500);
}
assertThat(events.size()).isEqualTo(1);
assertThat(events.get(0).getChangeSet().iterator().next().getFiles().iterator()
.next().getFile()).isEqualTo(classFile);