@Test
public void testOnMessageEvent() throws Exception {

    // setup mocks
    WebSocketContainer mockSocketContainer = mock(WebSocketContainer.class);
    when(mockSocketContainer.connectToServer(underTest, WEB_SOCKET_TEST_URI))
        .thenReturn(mock(Session.class));
    JsonSlackDAO slackDao = mock(JsonSlackDAO.class);
    when(slackDao.getRealtimeWebSocketURI()).thenReturn(WEB_SOCKET_TEST_URI);
    underTest.open(chatConfig, slackDao, mockSocketContainer, mockContext, mockCollector);
    String userId = "U03AFSSD";
    // make the chat API DAO return a map of users
    Map<String, User> users = ImmutableMap.of(userId,
                                              new User(userId, null, false, false,  false,
                                                       "name", "mention_name", null,
                                                       DateTime.now(), DateTime.now(), null,
                                                       null, null, null));
    when(slackDao.getUsers()).thenReturn(users);
    Message triggerMessage = new Message(DateTime.now(), "Test User", userId, "test msg",
                                         "C09ADF43", MESSAGE);
    underTest.onMessageEvent(triggerMessage, mock(Session.class));
    verify(slackDao).getUsers();
    verify(slackDao).getRooms();
    verify(slackDao).getRealtimeWebSocketURI();
    verifyNoMoreInteractions(slackDao);
    underTest.nextTuple();
    verify(mockCollector).emit(any(Values.class));
    verifyNoMoreInteractions(mockCollector);
    // make sure nothing got emitted
    underTest.nextTuple();
    verifyNoMoreInteractions(mockCollector);
}