use of fr.xephi.authme.message.MessageKey in project AuthMeReloaded by AuthMe.
the class LimboPlayerTaskManagerTest method shouldRegisterMessageTask.
@Test
public void shouldRegisterMessageTask() {
// given
Player player = mock(Player.class);
LimboPlayer limboPlayer = mock(LimboPlayer.class);
MessageKey key = MessageKey.REGISTER_MESSAGE;
given(messages.retrieveSingle(player, key)).willReturn("Please register!");
int interval = 12;
given(settings.getProperty(RegistrationSettings.MESSAGE_INTERVAL)).willReturn(interval);
// when
limboPlayerTaskManager.registerMessageTask(player, limboPlayer, LimboMessageType.REGISTER);
// then
verify(limboPlayer).setMessageTask(any(MessageTask.class));
verify(messages).retrieveSingle(player, key);
verify(bukkitService).runTaskTimer(any(MessageTask.class), eq(2L * TICKS_PER_SECOND), eq((long) interval * TICKS_PER_SECOND));
}
use of fr.xephi.authme.message.MessageKey in project AuthMeReloaded by AuthMe.
the class CommonServiceTest method shouldRetrieveSingleMessage.
@Test
public void shouldRetrieveSingleMessage() {
// given
MessageKey key = MessageKey.ACCOUNT_NOT_ACTIVATED;
Player player = mock(Player.class);
String text = "Test text";
given(messages.retrieveSingle(player, key)).willReturn(text);
// when
String result = commonService.retrieveSingleMessage(player, key);
// then
assertThat(result, equalTo(text));
verify(messages).retrieveSingle(player, key);
}
use of fr.xephi.authme.message.MessageKey in project AuthMeReloaded by AuthMe.
the class CommonServiceTest method shouldSendMessageToPlayer.
@Test
public void shouldSendMessageToPlayer() {
// given
CommandSender sender = mock(CommandSender.class);
MessageKey key = MessageKey.ACCOUNT_NOT_ACTIVATED;
// when
commonService.send(sender, key);
// then
verify(messages).send(sender, key);
}
use of fr.xephi.authme.message.MessageKey in project AuthMeReloaded by AuthMe.
the class CommonServiceTest method shouldSendMessageWithReplacements.
@Test
public void shouldSendMessageWithReplacements() {
// given
CommandSender sender = mock(CommandSender.class);
MessageKey key = MessageKey.ACCOUNT_NOT_ACTIVATED;
String[] replacements = new String[] { "test", "toast" };
// when
commonService.send(sender, key, replacements);
// then
verify(messages).send(sender, key, replacements);
}
Aggregations