@Test public void testOnModeratorSet() throws Exception { instance.onUserJoinedChannel(DEFAULT_CHANNEL_NAME, chatUser1); ObservableSet<String> moderatorInChannels = instance .getChatUsersForChannel(DEFAULT_CHANNEL_NAME) .get(chatUser1.getUsername()) .getModeratorInChannels(); assertThat(moderatorInChannels, empty()); instance.onModeratorSet(DEFAULT_CHANNEL_NAME, chatUser1.getUsername()); assertThat(moderatorInChannels, contains(DEFAULT_CHANNEL_NAME)); }
@Test public void testAddOnModeratorSetListener() throws Exception { instance.onUserJoinedChannel(DEFAULT_CHANNEL_NAME, chatUser1); ObservableSet<String> moderatorInChannels = instance .getChatUsersForChannel(DEFAULT_CHANNEL_NAME) .get(chatUser1.getUsername()) .getModeratorInChannels(); assertThat(moderatorInChannels, empty()); instance.onModeratorSet(DEFAULT_CHANNEL_NAME, chatUser1.getUsername()); assertThat(moderatorInChannels, hasSize(1)); assertThat(moderatorInChannels.iterator().next(), is(DEFAULT_CHANNEL_NAME)); }
@Test public void testOnModeratorSetUserNotInChannelDoesntThrowException() throws Exception { instance.onModeratorSet(DEFAULT_CHANNEL_NAME, chatUser1.getUsername()); }