use of commands.model.Command in project KaellyBot by Kaysoro.
the class CommandPatternTest method testCommandCommand.
public void testCommandCommand() {
Command cmd = new CommandCommand();
Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
assertTrue(pattern.matcher(Constants.prefixCommand + "cmd CommandForbidden true").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "cmd CommandForbidden on").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "cmd CommandForbidden 0").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "cmd CommandForbidden false").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "cmd CommandForbidden off").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "cmd CommandForbidden 1").find());
assertFalse(pattern.matcher(Constants.prefixCommand + "cmd").find());
assertFalse(pattern.matcher(Constants.prefixCommand + "cmd CommandForbidden").find());
}
use of commands.model.Command in project KaellyBot by Kaysoro.
the class CommandPatternTest method testPortalCommand.
public void testPortalCommand() {
Command cmd = new PortalCommand();
Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
assertTrue(pattern.matcher(Constants.prefixCommand + "pos").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "pos dimension").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "pos dimensiôn").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "pos dimension [1,-1]").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "pos dimension -1 1").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "pos dimension 1,-1 1").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "pos dimension [1,-1] 1").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "pos dimension 1").find());
}
use of commands.model.Command in project KaellyBot by Kaysoro.
the class CommandPatternTest method testHelpCommand.
public void testHelpCommand() {
Command cmd = new HelpCommand();
Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
assertTrue(pattern.matcher(Constants.prefixCommand + "help").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "help help").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "help hélp").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "help !help").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "help !help2").find());
}
use of commands.model.Command in project KaellyBot by Kaysoro.
the class CommandPatternTest method testTutorialCommand.
public void testTutorialCommand() {
Command cmd = new TutorialCommand();
Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
assertTrue(pattern.matcher(Constants.prefixCommand + "tuto test").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "tuto tést test").find());
assertFalse(pattern.matcher(Constants.prefixCommand + "tuto").find());
}
use of commands.model.Command in project KaellyBot by Kaysoro.
the class CommandPatternTest method testMapCommand.
public void testMapCommand() {
Command cmd = new MapCommand();
Pattern pattern = Pattern.compile("^" + Constants.prefixCommand + cmd.getName() + cmd.getPattern() + "$");
assertTrue(pattern.matcher(Constants.prefixCommand + "map").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "map I II III").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "map 1 2 3").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "map i ii iii").find());
assertTrue(pattern.matcher(Constants.prefixCommand + "map 1 ii III").find());
assertFalse(pattern.matcher(Constants.prefixCommand + "map un deûx trôis").find());
}
Aggregations