assertThat(watcher.isPolling()).isFalse();
}
@Test
public void testCloseCancelsAllKeysAndStopsPolling() throws IOException {
Key key1 = watcher.register(createDirectory(), ImmutableList.of(ENTRY_CREATE));
Key key2 = watcher.register(createDirectory(), ImmutableList.of(ENTRY_DELETE));
assertThat(key1.isValid()).isTrue();
assertThat(key2.isValid()).isTrue();
assertThat(watcher.isPolling()).isTrue();
watcher.close();
assertThat(key1.isValid()).isFalse();
assertThat(key2.isValid()).isFalse();
assertThat(watcher.isPolling()).isFalse();
}