### Question:
StopWatch { public StopWatch (long period, TimeUnit unit) { end = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(period, unit); } StopWatch(long period, TimeUnit unit);  StopWatch(long periodInMillis); void finish(); boolean isFinished(); static T get(long period, TimeUnit unit, Supplier<T> f); static T get(long period, Supplier<T> f);  }### Answer:
@Test public void testStopWatch() throws Throwable { long now = System.currentTimeMillis(); StopWatch sw = new StopWatch (500, TimeUnit.MILLISECONDS); assertFalse(sw.isFinished()); sw.finish(); assertTrue(System.currentTimeMillis() - now >= 500); assertTrue (sw.isFinished()); }