### Question:
TimeoutWatcher extends Thread { public void quit() { this.mQuit = true; synchronized (this) { notify(); } } TimeoutWatcher(long inTimeout); void update(); @Override void run(); abstract void timeoutHandling(); void quit();  }### Answer:
@Test public void testNoUpdate() throws InterruptedException { final int[] count = new int[1]; count[0] = 0; final TimeoutWatcher theWatcher = new TimeoutWatcher(500) { @Override public void timeoutHandling() { count[0]++; } }; try { theWatcher.start(); Thread.sleep(550); Assert.assertEquals(1, count[0]); } finally { theWatcher.quit(); } }