@Override
    public WatchKey register(final Watchable folder, final WatchEvent.Kind<?>[] events,
                             final WatchEvent.Modifier... modifiers) throws IOException {
        if(null == monitor) {
            monitor = FileSystems.getDefault().newWatchService();
        }
        final WatchKey key = folder.register(monitor, events, modifiers);
        if(log.isInfoEnabled()) {
            log.info(String.format("Registered for events for %s", key));
        }
        return key;
    }
@Test
    public void testRegister() throws Exception {
        final RegisterWatchService fs = new NIOEventWatchService();
        final Watchable folder = Paths.get(
            File.createTempFile(UUID.randomUUID().toString(), "t").getParent());
        final WatchKey key = fs.register(folder, new WatchEvent.Kind[]{ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY});
        assertTrue(key.isValid());
        fs.close();
        assertFalse(key.isValid());
    }