MessageBus { public static void sendAndReply(final IObject message, final Object replyToChainName) throws SendingMessageException { container.sendAndReply(message, replyToChainName); } private  MessageBus(); static IKey getMessageBusKey(); static void send(final IObject message); static void send(final IObject message, final Object chainName); static void sendAndReply(final IObject message, final Object replyToChainName); static void sendAndReply(final IObject message, final Object chainName, final Object replyToChainName);  }
@Test public void checkSendingMessageWithReply() throws Exception { IObject message = mock(IObject.class); Object chainNameForReply = mock(Object.class); MessageBus.sendAndReply(message, chainNameForReply); verify(this.container, times(1)).sendAndReply(message, chainNameForReply); }
@Test (expected = SendingMessageException.class) public void checkExceptionOnSendingMessageWithReply() throws SendingMessageException { doThrow(new SendingMessageException("")).when(this.container).sendAndReply(null, null); MessageBus.sendAndReply(null, null); fail(); }
@Test public void checkSendingMessageWithSpecificChainAndReply() throws Exception { IObject message = mock(IObject.class); Object chainName = mock(Object.class); Object chainNameForReply = mock(Object.class); MessageBus.sendAndReply(message, chainName, chainNameForReply); verify(this.container, times(1)).sendAndReply(message, chainName, chainNameForReply); }
@Test (expected = SendingMessageException.class) public void checkExceptionOnSendingMessageWithSpecificChainAndReply() throws SendingMessageException { doThrow(new SendingMessageException("")).when(this.container).sendAndReply(null, null, null); MessageBus.sendAndReply(null, null, null); fail(); }