QuerySensorHandle implements ISensorHandle { @Override public void shutdown() throws SensorShutdownException { try { entry.cancel(); } catch (EntryStorageAccessException | EntryScheduleException e) { throw new SensorShutdownException("Could not cancel sensor entry.", e); } } QuerySensorHandle(final ISchedulerEntry entry); @Override void shutdown();  }
@Test public void Should_cancelEntryOnSensorShutdown() throws Exception { ISchedulerEntry entry = mock(ISchedulerEntry.class); ISensorHandle handle = new QuerySensorHandle(entry); handle.shutdown(); verify(entry).cancel(); }