예제 #1
0
  @Test
  public void testIfHistoryStaysWithUsAfterNickChange() {
    Nick copyOfFictive = new Nick(fictive.getNickname());
    copyOfFictive.setNickname("fictive");

    assertEquals(0, history.getLastEvents(copyOfFictive).size());
    assertEquals(2, history.getLastEvents(fictive).size());
  }
예제 #2
0
  @Before
  public void setUp() {
    history = new History();

    rockj = new Nick("Rockj");
    fictive = new Nick("Fictive");
    melwil = new Nick("melwil");

    history.appendHistory(rockj, createJoinEvent("freenode", "#test", rockj.getNickname()));
    history.appendHistory(fictive, createJoinEvent("freenode", "#test", fictive.getNickname()));
    history.appendHistory(melwil, createJoinEvent("freenode", "#test", melwil.getNickname()));

    history.appendHistory(
        rockj,
        createPrivMsgEvent(
            "freenode", rockj.getNickname(), "#test", "This is a trolling message, what's up?!"));
    history.nickChangeHistory(createNickEvent("freenode", fictive.getNickname(), "fictiveLulz"));
    fictive.setNickname("fictiveLulz");
    for (int i = 0; i < 3; i++) {
      history.appendHistory(
          melwil,
          createPrivMsgEvent("freenode", melwil.getNickname(), "#test", "Flood " + i + "!"));
    }

    // Channel history here
    channel = new Channel("#test");

    history.appendChannelHistory(
        channel,
        createPrivMsgEvent("freenode", rockj.getNickname(), channel.getChannelname(), "Message 1"));
    history.appendChannelHistory(
        channel,
        createPrivMsgEvent("freenode", rockj.getNickname(), channel.getChannelname(), "Message 2"));
    history.appendChannelHistory(
        channel,
        createPrivMsgEvent("freenode", rockj.getNickname(), channel.getChannelname(), "Message 3"));
    history.appendChannelHistory(
        channel,
        createPrivMsgEvent("freenode", rockj.getNickname(), channel.getChannelname(), "Message 4"));
    history.appendChannelHistory(
        channel,
        createPrivMsgEvent(
            "freenode", fictive.getNickname(), channel.getChannelname(), "Message 5"));
    history.appendChannelHistory(
        channel,
        createPrivMsgEvent("freenode", rockj.getNickname(), channel.getChannelname(), "Message 6"));
    history.appendChannelHistory(
        channel,
        createPrivMsgEvent("freenode", rockj.getNickname(), channel.getChannelname(), "Message 7"));
  }