ReSendRestoringSequenceRecoverStrategy implements IRecoverStrategy { @Override public void init(final IObject state, final IObject args, final IMessageProcessor processor) throws RecoverStrategyInitializationException { try { IObject sequenceDump = IOC.resolve(Keys.getOrAdd("make dump"), processor.getSequence(), args); state.setValue(sequenceDumpFieldName, sequenceDump); } catch (ResolutionException | ChangeValueException | InvalidArgumentException e) { throw new RecoverStrategyInitializationException("Error occurred preparing dump of message processing sequence.", e); } } ReSendRestoringSequenceRecoverStrategy(); @Override void init(final IObject state, final IObject args, final IMessageProcessor processor); @Override void reSend(final IObject state);  }
@Test public void Should_makeDumpOfMessageProcessingSequenceOnInitialization() throws Exception { IObject stateMock = mock(IObject.class); IObject argsMock = mock(IObject.class); IObject dumpMock = mock(IObject.class); IMessageProcessor processorMock = mock(IMessageProcessor.class); IMessageProcessingSequence sequenceMock = mock(IMessageProcessingSequence.class); IResolveDependencyStrategy makeDumpStrategy = mock(IResolveDependencyStrategy.class); IOC.register(Keys.getOrAdd("make dump"), makeDumpStrategy); when(makeDumpStrategy.resolve(same(sequenceMock), same(argsMock))).thenReturn(dumpMock); when(processorMock.getSequence()).thenReturn(sequenceMock); new ReSendRestoringSequenceRecoverStrategy().init(stateMock, argsMock, processorMock); verify(stateMock).setValue(eq(IOC.resolve(Keys.getOrAdd("info.smart_tools.smartactors.iobject.ifield_name.IFieldName"), "sequenceDump")), same(dumpMock)); }