MessageBus { public static void send(final IObject message) throws SendingMessageException { container.send(message); } 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 checkSendingMessage() throws SendingMessageException { IObject message = mock(IObject.class); MessageBus.send(message); verify(this.container, times(1)).send(message); }
@Test (expected = SendingMessageException.class) public void checkExceptionOnSendingMessage() throws SendingMessageException { doThrow(new SendingMessageException("")).when(this.container).send(null); MessageBus.send(null); fail(); }
@Test public void checkSendingMessageWithSpecificChain() throws SendingMessageException { IObject message = mock(IObject.class); Object chainName = mock(Object.class); MessageBus.send(message, chainName); verify(this.container, times(1)).send(message, chainName); }
@Test (expected = SendingMessageException.class) public void checkExceptionOnSendingMessageWithSpecificChain() throws SendingMessageException { doThrow(new SendingMessageException("")).when(this.container).send(null, null); MessageBus.send(null, null); fail(); }