@Test
public void testLoadingConfig()
        throws Exception {

    IResolveDependencyStrategy sequenceStrategy = mock(IResolveDependencyStrategy.class);
    IOC.register(
            IOC.resolve(IOC.getKeyForKeyStorage(), "info.smart_tools.smartactors.message_processing_interfaces.message_processing.IMessageProcessingSequence"),
            sequenceStrategy
    );
    IResolveDependencyStrategy messageProcessorStrategy = mock(IResolveDependencyStrategy.class);
    IOC.register(
            IOC.resolve(IOC.getKeyForKeyStorage(), "info.smart_tools.smartactors.message_processing_interfaces.message_processing.IMessageProcessor"),
            messageProcessorStrategy
    );
    IOC.register(
            IOC.resolve(IOC.getKeyForKeyStorage(), "info.smart_tools.smartactors.iobject.iobject.IObject"),
            new ApplyFunctionToArgumentsStrategy(
                    (args) -> {
                        return new DSObject();
                    }
            )
    );
    when(chainStorage.resolve(mapId)).thenReturn(receiverChain);
    DSObject config = new DSObject("\n" +
            "     {\n" +
            "         \"messageBus\": \n" +
            "             {\n" +
            "                 \"routingChain\": \"mainChain\",\n" +
            "                 \"stackDepth\": 5\n" +
            "             }\n" +
            "         \n" +
            "     }");
    MessageBusSectionProcessingStrategy strategy = new MessageBusSectionProcessingStrategy();
    strategy.onLoadConfig(config);
    IMessageProcessingSequence sequence = mock(IMessageProcessingSequence.class);
    when(sequenceStrategy.resolve(5, this.receiverChain)).thenReturn(sequence);
    IMessageProcessor processor = mock(IMessageProcessor.class);
    when(messageProcessorStrategy.resolve(this.taskQueue, sequence)).thenReturn(processor);
    IObject result = new DSObject();
    doAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            result.setValue(new FieldName("message"), invocationOnMock.getArguments()[0]);
            result.setValue(new FieldName("context"), invocationOnMock.getArguments()[1]);
            return null;
        }
    }).when(processor).process(any(IObject.class), any(IObject.class));
    IMessageBusHandler handler = (IMessageBusHandler) ScopeProvider.getCurrentScope().getValue(MessageBus.getMessageBusKey());
    assertNotNull(handler);
    Object replyToChainName = mock(Object.class);
    IObject message = mock(IObject.class);
    handler.handleForReply(message, replyToChainName);
    assertSame(result.getValue(new FieldName("message")), message);
    IObject resultContext = (IObject) result.getValue(new FieldName("context"));
    List<IAction> actions = (List<IAction>) resultContext.getValue(new FieldName("finalActions"));
    assertEquals(actions.size(), 1);
    IAction<IObject> action = actions.get(0);
    IObject env = new DSObject();
    IObject messageForReply = new DSObject();
    env.setValue(new FieldName("message"), messageForReply);
    env.setValue(new FieldName("context"), resultContext);
    action.execute(env);
    verify(responseAction, times(1)).execute(env);
}