MessagingUtils { public void sendResultsMessage(long sessionId) { template.convertAndSend(getTopic(TOPIC_RESULTS, sessionId), resultsMessage(sessionManager.getResults(sessionId))); } @Autowired  MessagingUtils(SessionManager sessionManager, Clock clock, SimpMessagingTemplate template); @Contract(pure = true) static String getTopic(String topicRoot, long sessionId); void sendResultsMessage(long sessionId); void sendUsersMessage(long sessionId); @Async void burstResultsMessages(long sessionId); @Async void burstUsersMessages(long sessionId); static final String TOPIC_RESULTS; static final String TOPIC_USERS; static final String TOPIC_ITEM; }
@Test public void testSendResultsMessage() throws Exception { when(sessionManager.getResults(SESSION_ID)).thenReturn(RESULTS); messagingUtils.sendResultsMessage(SESSION_ID); verifyMessageSent(1, getTopic(TOPIC_RESULTS, SESSION_ID), messagingUtils.resultsMessage(RESULTS)); }