IOWatchServiceNonDotImpl extends AbstractIOWatchService { boolean shouldFilter(Path path) { return path != null && path.getFileName() != null && path.getFileName().toString().startsWith("."); } IOWatchServiceNonDotImpl(); @Inject  IOWatchServiceNonDotImpl(Event<ResourceBatchChangesEvent> resourceBatchChanges,
                                    Event<ResourceUpdatedEvent> resourceUpdatedEvent,
                                    Event<ResourceRenamedEvent> resourceRenamedEvent,
                                    Event<ResourceDeletedEvent> resourceDeletedEvent,
                                    Event<ResourceAddedEvent> resourceAddedEvent,
                                    @Unmanaged ExecutorService executorService); @Override boolean doFilter(WatchEvent<?> object);  }
@Test public void shouldFilterTest() { Path path = mock(Path.class); IOWatchServiceNonDotImpl io = new IOWatchServiceNonDotImpl(); assertFalse(io.shouldFilter(null)); when(path.getFileName()).thenReturn(null); assertFalse(io.shouldFilter(path)); Path filename = mock(Path.class); when(filename.toString()).thenReturn("dont_start_with_."); when(path.getFileName()).thenReturn(filename); assertFalse(io.shouldFilter(path)); when(filename.toString()).thenReturn(".dora"); assertTrue(io.shouldFilter(path)); }