### Question:
GlusterWatchService implements WatchService { long timeoutToMillis(long timeout, TimeUnit unit) { switch (unit) { case DAYS: return (timeout * MILLIS_PER_DAY); case HOURS: return (timeout * MILLIS_PER_HOUR); case MINUTES: return (timeout * MILLIS_PER_MINUTE); case SECONDS: return (timeout * MILLIS_PER_SECOND); case MILLISECONDS: return timeout; default: return -1; } }  WatchKey registerPath(GlusterPath path, WatchEvent.Kind... kinds); @Override void close(); @Override WatchKey poll(); @Override WatchKey poll(long timeout, TimeUnit unit); @Override WatchKey take(); static final int MILLIS_PER_SECOND; static final int MILLIS_PER_MINUTE; static final int MILLIS_PER_HOUR; static final int MILLIS_PER_DAY; static long PERIOD; }### Answer:
@Test public void testTimeoutToMillis() { long time = 12345L; Assert.assertEquals(-1, watchService.timeoutToMillis(time, TimeUnit.NANOSECONDS)); Assert.assertEquals(-1, watchService.timeoutToMillis(time, TimeUnit.MICROSECONDS)); Assert.assertEquals(time, watchService.timeoutToMillis(time, TimeUnit.MILLISECONDS)); Assert.assertEquals(time * GlusterWatchService.MILLIS_PER_SECOND, watchService.timeoutToMillis(time, TimeUnit.SECONDS)); Assert.assertEquals(time * GlusterWatchService.MILLIS_PER_MINUTE, watchService.timeoutToMillis(time, TimeUnit.MINUTES)); Assert.assertEquals(time * GlusterWatchService.MILLIS_PER_HOUR, watchService.timeoutToMillis(time, TimeUnit.HOURS)); Assert.assertEquals(time * GlusterWatchService.MILLIS_PER_DAY, watchService.timeoutToMillis(time, TimeUnit.DAYS)); }