コード例 #1
0
  @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));
  }