PurgeFiltersJob implements Runnable { @Override public void run() { try { purgatory.purge(); } catch (Exception ex) { logger.error("Purge bloom filter service failed.", ex); } } PurgeFiltersJob(Purgatory purgatory); @Override void run();  }
@Test public void testPurge() { doNothing().when(purgatory).purge(); job.run(); verify(purgatory, times(1)).purge(); }
@Test public void testPurgeThrowsException() { final RuntimeException ex = new RuntimeException("expected exception"); doThrow(ex).when(purgatory).purge(); job.run(); verify(purgatory, times(1)).purge(); }