MessagingUtils { public void sendUsersMessage(long sessionId) { template.convertAndSend(getTopic(TOPIC_USERS, sessionId), usersMessage(sessionManager.getSessionUsers(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 testSendUsersMessage() throws Exception { when(sessionManager.getSessionUsers(SESSION_ID)).thenReturn(USERS); messagingUtils.sendUsersMessage(SESSION_ID); verifyMessageSent(1, getTopic(TOPIC_USERS, SESSION_ID), messagingUtils.usersMessage((USERS))); }