use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class HasPermissionCheckerTest method shouldShowUsageInfo.
@Test
public void shouldShowUsageInfo() {
// given
CommandSender sender = mock(CommandSender.class);
// when
hasPermissionChecker.execute(sender, emptyList());
// then
ArgumentCaptor<String> msgCaptor = ArgumentCaptor.forClass(String.class);
verify(sender, atLeast(2)).sendMessage(msgCaptor.capture());
assertThat(msgCaptor.getAllValues().stream().anyMatch(msg -> msg.contains("/authme debug perm bobby my.perm.node")), equalTo(true));
}
use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class ChangeEmailCommandTest method shouldRejectNonPlayerSender.
@Test
public void shouldRejectNonPlayerSender() {
// given
CommandSender sender = mock(BlockCommandSender.class);
// when
command.executeCommand(sender, Collections.emptyList());
// then
verifyNoInteractions(management);
}
use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class AddEmailCommandTest method shouldRejectNonPlayerSender.
@Test
public void shouldRejectNonPlayerSender() {
// given
CommandSender sender = mock(BlockCommandSender.class);
// when
command.executeCommand(sender, Collections.emptyList());
// then
verifyNoInteractions(management);
}
use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class EmailBaseCommandTest method shouldDisplayHelp.
@Test
public void shouldDisplayHelp() {
// given
CommandSender sender = mock(CommandSender.class);
FoundCommandResult result = mock(FoundCommandResult.class);
given(commandMapper.mapPartsToCommand(eq(sender), anyList())).willReturn(result);
// when
command.executeCommand(sender, Collections.emptyList());
// then
verify(commandMapper).mapPartsToCommand(sender, Collections.singletonList("email"));
verify(helpProvider).outputHelp(sender, result, HelpProvider.SHOW_CHILDREN);
}
use of org.bukkit.command.CommandSender in project AuthMeReloaded by AuthMe.
the class TotpBaseCommandTest method shouldOutputHelp.
@Test
public void shouldOutputHelp() {
// given
CommandSender sender = mock(CommandSender.class);
FoundCommandResult mappingResult = mock(FoundCommandResult.class);
given(mapper.mapPartsToCommand(sender, Collections.singletonList("totp"))).willReturn(mappingResult);
// when
command.executeCommand(sender, Collections.emptyList());
// then
verify(mapper).mapPartsToCommand(sender, Collections.singletonList("totp"));
verify(helpProvider).outputHelp(sender, mappingResult, HelpProvider.SHOW_CHILDREN);
}
Aggregations