### Question:
BrokerProxyService implements BrokerProxy { @Override public void routeMessage (Object message) { if (router.route(message)) { if (!(message instanceof TariffSpecification)) { visualizerProxyService.forwardMessage(message); } } } 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 routeMessageTest() { when(router.route(message)).thenReturn(false); brokerProxy.routeMessage(message); verify(router, times(1)).route(message); verify(visualizer, times(0)).forwardMessage(message); reset(router); reset(visualizer); when(router.route(message)).thenReturn(true); brokerProxy.routeMessage(message); verify(router, times(1)).route(message); verify(visualizer, times(1)).forwardMessage(message); }