MessageBusContainer implements IMessageBusContainer { @Override public void sendAndReply(final IObject message, final Object replyToChainName) throws SendingMessageException { try { final IMessageBusHandler handler = (IMessageBusHandler) ScopeProvider .getCurrentScope() .getValue(messageBusContainerKey); handler.handleForReply(message, replyToChainName); } catch (ScopeException e) { throw new SendingMessageException("Could not get MessageBusContainer with key: " + messageBusContainerKey + " from the current scope.", e); } catch (ScopeProviderException e) { throw new SendingMessageException("Could not get current scope.", e); } catch (Throwable e) { throw new SendingMessageException("Could not send message with a reply to chain " + replyToChainName, e); } } MessageBusContainer(); @Override IKey getMessageBusKey(); @Override void send(final IObject message); @Override void send(final IObject message, final Object chainName); @Override void sendAndReply(final IObject message, final Object replyToChainName); @Override void sendAndReply(final IObject message, final Object chainName, final Object replyToChainName);  }
@Test (expected = SendingMessageException.class) public void checkSendingMessageExceptionOnSendingWithReply() throws Exception { IMessageBusContainer messageBusContainer = new MessageBusContainer(); messageBusContainer.sendAndReply(null, null); fail(); }
@Test (expected = SendingMessageException.class) public void checkSendingMessageExceptionOnSendingWithSpecificChainAndReply() throws Exception { IMessageBusContainer messageBusContainer = new MessageBusContainer(); messageBusContainer.sendAndReply(null, null, null); fail(); }