CheckpointActor { public void stop(final StartStopMessage message) throws IllegalServiceStateException, ServiceStopException { service.stop(); } CheckpointActor(final IObject args); void enter(final EnteringMessage message); void feedback(final FeedbackMessage message); void start(final StartStopMessage message); void stop(final StartStopMessage message); void configure(final ConfigureMessage message);  }
@Test public void Should_registerUpCounterCallback() throws Exception { IObject args = IOC.resolve(Keys.getOrAdd("info.smart_tools.smartactors.iobject.iobject.IObject"), ("{" + "'connectionOptionsDependency':'the connection options'," + "'connectionPoolDependency':'the connection pool'," + "'collectionName':'" + collectionName + "'" + "}").replace('\'','"')); CheckpointActor actor = new CheckpointActor(args); ArgumentCaptor<IAction> callbackCaptor = ArgumentCaptor.forClass(IAction.class); verify(upCounterMock).onShutdownRequest(callbackCaptor.capture()); callbackCaptor.getValue().execute(null); verify(serviceMock).stop(); doThrow(ServiceStopException.class).when(serviceMock).stop(); try { callbackCaptor.getValue().execute(null); fail(); } catch (ActionExecuteException ignore) { } doThrow(IllegalServiceStateException.class).when(serviceMock).stop(); callbackCaptor.getValue().execute(null); }