Пример #1
0
 @Test
 public void privmsgMessageParametersEndResult() {
   IrcMessage privmsgMessage = new IrcMessage(StaticMessages.privmsg);
   // Parameter 0 for a privmsg message should be the channel or user receiving the message
   assertEquals("#online.irclib", privmsgMessage.getParameters().get(0));
   // Parameter 1 for a privmsg message should be the message itself
   assertEquals("testing privmsg", privmsgMessage.getParameters().get(1));
 }
Пример #2
0
 @Test
 public void modeMessageParametersEndResult() {
   IrcMessage modeMessage = new IrcMessage(StaticMessages.mode);
   assertEquals("#online.irclib", modeMessage.getParameters().get(0));
   assertEquals("+ovo", modeMessage.getParameters().get(1));
   assertEquals("nickname1", modeMessage.getParameters().get(2));
   assertEquals("nickname2", modeMessage.getParameters().get(3));
   assertEquals("nickname3", modeMessage.getParameters().get(4));
 }
Пример #3
0
  @Test
  public void shouldReturnNickname() {
    IrcMessage aMessage = new IrcMessage(StaticMessages.join);
    assertEquals("irclib", aMessage.getNickname());

    aMessage = new IrcMessage(StaticMessages.messageWithoutIdent);
    assertEquals("irclib", aMessage.getNickname());

    aMessage = new IrcMessage(StaticMessages.messageWithoutIdentAndHost);
    assertEquals("irclib", aMessage.getNickname());
  }
Пример #4
0
 @Test
 public void modeMessageCommandShouldEqualMODE() {
   IrcMessage modeMessage = new IrcMessage(StaticMessages.mode);
   assertEquals("MODE", modeMessage.getCommand());
 }
Пример #5
0
 @Test
 public void pingMessageCommandShouldEqualPING() {
   IrcMessage pingMessage = new IrcMessage(StaticMessages.ping);
   assertEquals("PING", pingMessage.getCommand());
 }
Пример #6
0
 @Test
 public void pingMessageParametersEndResult() {
   IrcMessage pingMessage = new IrcMessage(StaticMessages.ping);
   assertEquals("chat.freenode.net", pingMessage.getParameters().get(0));
 }
Пример #7
0
 @Test
 public void ptivmsgMessageCommandShouldEqualPRIVMSG() {
   IrcMessage privmsg = new IrcMessage(StaticMessages.privmsg);
   assertEquals("PRIVMSG", privmsg.getCommand());
 }
Пример #8
0
 @Test
 public void shouldReturnEmptyHost() {
   IrcMessage aMessage = new IrcMessage(StaticMessages.messageWithoutIdentAndHost);
   assertEquals("", aMessage.getHost());
 }
Пример #9
0
 @Test
 public void shouldReturnEmptyNickname() {
   IrcMessage aMessage = new IrcMessage(StaticMessages.ping);
   assertEquals("", aMessage.getNickname());
 }
Пример #10
0
 @Test
 public void nickMessageParametersEndResult() {
   IrcMessage nickMessage = new IrcMessage(StaticMessages.nick);
   // Parameter 0 for a nick message should be the new nick
   assertEquals("irclib2", nickMessage.getParameters().get(0));
 }
Пример #11
0
 @Test
 public void joinMessageCommandShouldEqualJOIN() {
   IrcMessage joinMessage = new IrcMessage(StaticMessages.join);
   // Command for a join message should be "JOIN"
   assertEquals("JOIN", joinMessage.getCommand());
 }
Пример #12
0
 @Test
 public void shouldReturnRawMessage() {
   IrcMessage aMessage = new IrcMessage(StaticMessages.endofMOTD);
   assertEquals(StaticMessages.endofMOTD, aMessage.getMessage());
 }
Пример #13
0
 @Test
 public void shouldNotBeANumericMessage() {
   IrcMessage aMessage = new IrcMessage(StaticMessages.join);
   assertFalse(aMessage.isNumeric());
 }
Пример #14
0
 @Test
 public void shouldBeANumericMessage() {
   IrcMessage aMessage = new IrcMessage(StaticMessages.endofMOTD);
   assertTrue(aMessage.isNumeric());
 }
Пример #15
0
 @Test
 public void shouldReturnServerName() {
   IrcMessage aMessage = new IrcMessage(StaticMessages.pong);
   assertEquals("niven.freenode.net", aMessage.getServerName());
 }
Пример #16
0
 @Test
 public void joinMessageParametersEndResult() {
   IrcMessage joinMessage = new IrcMessage(StaticMessages.join);
   // Parameter 0 for a join message should be the joined channels name.
   assertEquals("#online.irclib", joinMessage.getParameters().get(0));
 }
Пример #17
0
 @Test
 public void nickMessageCommandShouldEqualNICK() {
   IrcMessage joinMessage = new IrcMessage(StaticMessages.nick);
   // Command for a nick message should be "NICK"
   assertEquals("NICK", joinMessage.getCommand());
 }
Пример #18
0
 @Test
 public void shouldReturnIdent() {
   IrcMessage aMessage = new IrcMessage(StaticMessages.join);
   assertEquals("user", aMessage.getIdent());
 }
Пример #19
0
 @Test
 public void shouldReturnHost() {
   IrcMessage aMessage = new IrcMessage(StaticMessages.join);
   assertEquals("host.somewhere.no", aMessage.getHost());
 }