Example #1
0
  @Test
  public void testPlugins() {
    Bot bot = new Bot("test", null);
    bot.loadMessagePlugin(new Admin());
    bot.loadMessagePlugin(new Help());

    Message message = new Message(bot, "testchannel", "testsender", new MessageParser("!plugins"));
    bot.onMockMessage(message);

    Assert.assertEquals("Plugins: [Admin, Help]", message.getReplies().firstElement());
  }
Example #2
0
  @Test
  public void testHelpVersion() {
    Main.instance = new Main();
    Bot bot = new Bot("test", new Server("localhost"));
    bot.loadMessagePlugin(new Help());

    Message message = new Message(bot, "testchannel", "testsender", new MessageParser("!help"));
    bot.onMockMessage(message);

    Assert.assertThat(
        message.getReplies().firstElement(), Matchers.startsWith("Hi. I support these commands"));
  }