Fix the tests failing
This commit is contained in:
parent
a088577bee
commit
0bb25e6324
@ -53,48 +53,48 @@ public class TestJailCommandInfo {
|
|||||||
@Test
|
@Test
|
||||||
public void testForPlayerContext() {
|
public void testForPlayerContext() {
|
||||||
Command command = mock(Command.class);
|
Command command = mock(Command.class);
|
||||||
when(command.getName()).thenReturn("jailcreate");
|
when(command.getName()).thenReturn("jail");
|
||||||
String[] args = { "testJail" };
|
String[] args = { "create", "testJail" };
|
||||||
|
|
||||||
CommandSender sender = creator.getCommandSender();
|
CommandSender sender = creator.getCommandSender();
|
||||||
|
|
||||||
assertTrue(main.onCommand(sender, command, "jailcreate", args));
|
assertTrue(main.onCommand(sender, command, "jail", args));
|
||||||
verify(sender).sendMessage(ChatColor.RED + "A player context is required for this.");
|
verify(sender).sendMessage(ChatColor.RED + "A player context is required for this.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMinimumArgs() {
|
public void testMinimumArgs() {
|
||||||
Command command = mock(Command.class);
|
Command command = mock(Command.class);
|
||||||
when(command.getName()).thenReturn("jailcreate");
|
when(command.getName()).thenReturn("jail");
|
||||||
String[] args = {};
|
String[] args = { "create" };
|
||||||
|
|
||||||
CommandSender sender = creator.getPlayerCommandSender();
|
CommandSender sender = creator.getPlayerCommandSender();
|
||||||
|
|
||||||
assertTrue(main.onCommand(sender, command, "jailcreate", args));
|
assertTrue(main.onCommand(sender, command, "jail", args));
|
||||||
verify(sender).sendMessage("/jailcreate [name]"); // If you change which command we test against, then change this
|
verify(sender).sendMessage("/jail create [name]"); // If you change which command we test against, then change this
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMaximumArgs() {
|
public void testMaximumArgs() {
|
||||||
Command command = mock(Command.class);
|
Command command = mock(Command.class);
|
||||||
when(command.getName()).thenReturn("jailcreate");
|
when(command.getName()).thenReturn("jail");
|
||||||
String[] args = { "testing", "badarg", "reallyterribleone" };
|
String[] args = { "create", "testing", "badarg", "reallyterribleone" };
|
||||||
|
|
||||||
CommandSender sender = creator.getPlayerCommandSender();
|
CommandSender sender = creator.getPlayerCommandSender();
|
||||||
|
|
||||||
assertTrue(main.onCommand(sender, command, "jailcreate", args));
|
assertTrue(main.onCommand(sender, command, "jail", args));
|
||||||
verify(sender).sendMessage("/jailcreate [name]"); // If you change which command we test against, then change this
|
verify(sender).sendMessage("/jail create [name]"); // If you change which command we test against, then change this
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccessfulJailCreateCommand() {
|
public void testSuccessfulJailCreateCommand() {
|
||||||
Command command = mock(Command.class);
|
Command command = mock(Command.class);
|
||||||
when(command.getName()).thenReturn("jailcreate");
|
when(command.getName()).thenReturn("jail");
|
||||||
String[] args = { "testJail" };
|
String[] args = { "create", "testJail" };
|
||||||
|
|
||||||
CommandSender sender = creator.getPlayerCommandSender();
|
CommandSender sender = creator.getPlayerCommandSender();
|
||||||
|
|
||||||
assertTrue(main.onCommand(sender, command, "jailcreate", args));
|
assertTrue(main.onCommand(sender, command, "jail", args));
|
||||||
verify(sender).sendMessage(ChatColor.AQUA + "----------Jail Zone Creation----------");
|
verify(sender).sendMessage(ChatColor.AQUA + "----------Jail Zone Creation----------");
|
||||||
verify(sender).sendMessage(ChatColor.GREEN + "First, you must select jail cuboid. Select the first point of the cuboid by right clicking on the block with your wooden sword. DO NOT FORGET TO MARK THE FLOOR AND CEILING TOO!");
|
verify(sender).sendMessage(ChatColor.GREEN + "First, you must select jail cuboid. Select the first point of the cuboid by right clicking on the block with your wooden sword. DO NOT FORGET TO MARK THE FLOOR AND CEILING TOO!");
|
||||||
verify(sender).sendMessage(ChatColor.AQUA + "--------------------------------------");
|
verify(sender).sendMessage(ChatColor.AQUA + "--------------------------------------");
|
||||||
|
Loading…
Reference in New Issue
Block a user