Exemplo n.º 1
0
 static void checkExpectedEvent(
     Iterable<WatchEvent<?>> events, WatchEvent.Kind<?> expectedKind, Object expectedContext) {
   WatchEvent<?> event = events.iterator().next();
   System.out.format(
       "got event: type=%s, count=%d, context=%s\n", event.kind(), event.count(), event.context());
   if (event.kind() != expectedKind) throw new RuntimeException("unexpected event");
   if (!expectedContext.equals(event.context())) throw new RuntimeException("unexpected context");
 }