use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class PlayerAuthViewerTest method shouldMakeExample.
@Test
public void shouldMakeExample() {
// given
CommandSender sender = mock(CommandSender.class);
// when
authViewer.execute(sender, Collections.emptyList());
// then
verify(sender).sendMessage(argThat(containsString("Example: /authme debug db Bobby")));
}
use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class PlayerAuthViewerTest method shouldHandleMissingPlayer.
@Test
public void shouldHandleMissingPlayer() {
// given
CommandSender sender = mock(CommandSender.class);
// when
authViewer.execute(sender, Collections.singletonList("bogus"));
// then
verify(dataSource).getAuth("bogus");
verify(sender).sendMessage(argThat(containsString("No record exists for 'bogus'")));
}
use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class ChangePasswordCommandTest method shouldRejectNonPlayerSender.
@Test
public void shouldRejectNonPlayerSender() {
// given
CommandSender sender = mock(BlockCommandSender.class);
// when
command.executeCommand(sender, Collections.emptyList());
// then
verify(sender).sendMessage(argThat(containsString("use /authme password <playername> <password> instead")));
}
use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class PurgeBannedPlayersCommandTest method shouldForwardRequestToService.
@Test
public void shouldForwardRequestToService() {
// given
String[] names = { "bannedPlayer", "other_banned", "evilplayer", "Someone" };
OfflinePlayer[] players = offlinePlayersWithNames(names);
given(bukkitService.getBannedPlayers()).willReturn(newHashSet(players));
CommandSender sender = mock(CommandSender.class);
// when
command.executeCommand(sender, Collections.emptyList());
// then
verify(bukkitService).getBannedPlayers();
verify(purgeService).purgePlayers(eq(sender), eq(asLowerCaseSet(names)), argThat(arrayContainingInAnyOrder(players)));
}
use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class PlayerCommandTest method shouldRejectNonPlayerAndSendAlternative.
@Test
public void shouldRejectNonPlayerAndSendAlternative() {
// given
CommandSender sender = mock(CommandSender.class);
PlayerCommandWithAlt command = new PlayerCommandWithAlt();
// when
command.executeCommand(sender, Collections.emptyList());
// then
verify(sender, times(1)).sendMessage(argThat(containsString("use /authme test <command> instead")));
}
Aggregations