@Test
  public void testRegister() throws IOException {
    Watchable watchable = new StubWatchable();
    AbstractWatchService.Key key = watcher.register(watchable, ImmutableSet.of(ENTRY_CREATE));
    assertThat(key.isValid()).isTrue();
    assertThat(key.pollEvents()).isEmpty();
    assertThat(key.subscribesTo(ENTRY_CREATE)).isTrue();
    assertThat(key.subscribesTo(ENTRY_DELETE)).isFalse();
    assertThat(key.watchable()).isEqualTo(watchable);
    assertThat(key.state()).isEqualTo(READY);
  }
Tests for {@link AbstractWatchService}.

@author Colin Decker
jimfs/src/test/java/com/google/common/jimfs/AbstractWatchServiceTest.java