Search in sources :

Example 26 with Command

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

the class CommandPatternTest method testStatCommand.

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

Example 27 with Command

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

the class CommandPatternTest method testAnnounceCommand.

public void testAnnounceCommand() {
    Command cmd = new AnnounceCommand();
    Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
    assertTrue(pattern.matcher(Constants.prefixCommand + "announce test").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "announce -confirm test").find());
    assertFalse(pattern.matcher(Constants.prefixCommand + "announce").find());
}
Also used : Pattern(java.util.regex.Pattern) Command(commands.model.Command)

Example 28 with Command

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

the class CommandPatternTest method testWhoisCommand.

public void testWhoisCommand() {
    Command cmd = new WhoisCommand();
    Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
    assertTrue(pattern.matcher(Constants.prefixCommand + "whois test").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "whois test-test").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "whois test-test server").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "whois test-test EL server").find());
    assertFalse(pattern.matcher(Constants.prefixCommand + "whois").find());
}
Also used : Pattern(java.util.regex.Pattern) Command(commands.model.Command)

Example 29 with Command

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

the class CommandPatternTest method testPrefixeCommand.

public void testPrefixeCommand() {
    Command cmd = new PrefixCommand();
    Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
    assertFalse(pattern.matcher(Constants.prefixCommand + "prefix").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "prefix test").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "prefix !&").find());
}
Also used : Pattern(java.util.regex.Pattern) Command(commands.model.Command)

Example 30 with Command

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

the class CommandPatternTest method testAvailableCommand.

public void testAvailableCommand() {
    Command cmd = new AvailableCommand();
    Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
    assertTrue(pattern.matcher(Constants.prefixCommand + "available CommandForbidden true").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "available CommandForbidden on").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "available CommandForbidden 0").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "available CommandForbidden false").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "available CommandForbidden off").find());
    assertTrue(pattern.matcher(Constants.prefixCommand + "available CommandForbidden 1").find());
    assertFalse(pattern.matcher(Constants.prefixCommand + "available").find());
    assertFalse(pattern.matcher(Constants.prefixCommand + "available CommandForbidden").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