SchedulerActor { public void stop(final StartStopMessage message) throws IllegalServiceStateException, ServiceStopException { service.stop(); } SchedulerActor(final IObject args); void addEntry(final AddEntryQueryMessage message); void addEntryWithSettingId(final SetEntryIdMessage message); void addEntryList(final AddEntryQueryListMessage message); void listEntries(final ListEntriesQueryMessage message); void deleteEntry(final DeleteEntryQueryMessage message); void start(final StartStopMessage message); void stop(final StartStopMessage message); void configure(final ConfigureQueryMessage message);  }
@Test public void Should_stopService() throws Exception { new SchedulerActor(args).stop(mock(StartStopMessage.class)); verify(service).stop(); }
@Test public void Should_registerUpCounterShutdownCompletionCallback() throws Exception { SchedulerActor actor = new SchedulerActor(args); ArgumentCaptor<IPoorAction> callbackCaptor = ArgumentCaptor.forClass(IPoorAction.class); verify(upCounterMock).onShutdownComplete(callbackCaptor.capture()); callbackCaptor.getValue().execute(); verify(service).stop(); doThrow(ServiceStopException.class).when(service).stop(); try { callbackCaptor.getValue().execute(); fail(); } catch (ActionExecuteException ignore) { } doThrow(IllegalServiceStateException.class).when(service).stop(); callbackCaptor.getValue().execute(); }