Search in sources :

Example 16 with Command

use of commands.model.Command in project KaellyBot by Kaysoro.

the class CommandPatternTest method testGuildCommand.

public void testGuildCommand() {
    Command cmd = new GuildCommand();
    Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
    assertTrue(pattern.matcher(Constants.prefixCommand + "guild La Feuille Verte").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "guild La-Feuil' [Verte]").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "guild La Feuille Verte -serv Furye").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "guild La-Feuil' [Verte] -serv Furye").find());
    assertFalse(pattern.matcher(Constants.prefixCommand + "guild").find());
}
Also used : Pattern(java.util.regex.Pattern) Command(commands.model.Command)

Example 17 with Command

use of commands.model.Command in project KaellyBot by Kaysoro.

the class CommandPatternTest method testAboutCommand.

public void testAboutCommand() {
    Command cmd = new AboutCommand();
    Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
    assertTrue(pattern.matcher(Constants.prefixCommand + "about").find());
}
Also used : Pattern(java.util.regex.Pattern) Command(commands.model.Command)

Example 18 with Command

use of commands.model.Command in project KaellyBot by Kaysoro.

the class CommandPatternTest method testResourceCommand.

public void testResourceCommand() {
    Command cmd = new ResourceCommand();
    Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
    assertTrue(pattern.matcher(Constants.prefixCommand + "resource test").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "resource tést test").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "resource -more tést test").find());
    assertFalse(pattern.matcher(Constants.prefixCommand + "resource").find());
}
Also used : Pattern(java.util.regex.Pattern) Command(commands.model.Command)

Example 19 with Command

use of commands.model.Command in project KaellyBot by Kaysoro.

the class CommandPatternTest method testMonsterCommand.

public void testMonsterCommand() {
    Command cmd = new MonsterCommand();
    Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
    assertTrue(pattern.matcher(Constants.prefixCommand + "monster test").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "monster tést test").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "monster -more tést test").find());
    assertFalse(pattern.matcher(Constants.prefixCommand + "monster").find());
}
Also used : Pattern(java.util.regex.Pattern) Command(commands.model.Command)

Example 20 with Command

use of commands.model.Command in project KaellyBot by Kaysoro.

the class CommandPatternTest method testLangCommand.

public void testLangCommand() {
    Command cmd = new LanguageCommand();
    Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
    assertTrue(pattern.matcher(Constants.prefixCommand + "lang FR").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "lang -channel FR").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "lang").find());
}
Also used : Pattern(java.util.regex.Pattern) Command(commands.model.Command)

Aggregations

Command (commands.model.Command)32 Pattern (java.util.regex.Pattern)28 AbstractCommand (commands.model.AbstractCommand)4 Language (enums.Language)4 Matcher (java.util.regex.Matcher)4 ArrayList (java.util.ArrayList)2 AboutCommand (commands.classic.AboutCommand)1 CommandForbidden (data.CommandForbidden)1 Guild (data.Guild)1