### Question:
BrokerProxyService implements BrokerProxy { @Override public void sendMessage (Broker broker, Object messageObject) { if (broker.isEnabled()) visualizerProxyService.forwardMessage(messageObject); localSendMessage(broker, messageObject); } BrokerProxyService(); @Override void sendMessage(Broker broker, Object messageObject); @Override void sendMessages(Broker broker, List<?> messageObjects); @Override void broadcastMessage(Object messageObject); @Override void broadcastMessages(List<?> messageObjects); @Override void routeMessage(Object message); @Override void registerBrokerMessageListener(Object listener, Class<?> msgType); @Override void setDeferredBroadcast(boolean b); @Override void broadcastDeferredMessages();  }### Answer:
@Test public void testSendMessage_single() { brokerProxy.sendMessage(stdBroker, message); verify(template, times(0)).send(any(String.class), any(MessageCreator.class)); stdBroker.setEnabled(true); brokerProxy.sendMessage(stdBroker, message); verify(template, times(1)).send(any(String.class), any(MessageCreator.class)); }
@Test public void localBrokerSingleMessage () { brokerProxy.sendMessage(localBroker, message); assertEquals(0, localBroker.messages.size(), "no messages for non-enabled broker"); localBroker.setEnabled(true); brokerProxy.sendMessage(localBroker, message); assertEquals(1, localBroker.messages.size(), "one message for enabled broker"); assertEquals(message, localBroker.messages.get(0), "correct message arrived"); }
@Test public void wholesaleBrokerSingleMessage () { brokerProxy.sendMessage(wholesaleBroker, message); assertEquals(1, wholesaleBroker.messages.size(), "one message for wholesale broker"); assertEquals(message, wholesaleBroker.messages.get(0), "correct message arrived"); }