#745 Fix unit tests for changes muting message task upon captcha
This commit is contained in:
@@ -3,7 +3,10 @@ package fr.xephi.authme.command.executable.captcha;
|
||||
import fr.xephi.authme.data.CaptchaManager;
|
||||
import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.command.CommandService;
|
||||
import fr.xephi.authme.data.limbo.LimboCache;
|
||||
import fr.xephi.authme.data.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -36,6 +39,9 @@ public class CaptchaCommandTest {
|
||||
@Mock
|
||||
private CommandService commandService;
|
||||
|
||||
@Mock
|
||||
private LimboCache limboCache;
|
||||
|
||||
@Test
|
||||
public void shouldDetectIfPlayerIsLoggedIn() {
|
||||
// given
|
||||
@@ -76,6 +82,10 @@ public class CaptchaCommandTest {
|
||||
given(captchaManager.isCaptchaRequired(name)).willReturn(true);
|
||||
String captchaCode = "3991";
|
||||
given(captchaManager.checkCode(name, captchaCode)).willReturn(true);
|
||||
MessageTask messageTask = mock(MessageTask.class);
|
||||
LimboPlayer limboPlayer = mock(LimboPlayer.class);
|
||||
given(limboPlayer.getMessageTask()).willReturn(messageTask);
|
||||
given(limboCache.getPlayerData(name)).willReturn(limboPlayer);
|
||||
|
||||
// when
|
||||
command.executeCommand(player, Collections.singletonList(captchaCode));
|
||||
@@ -86,6 +96,7 @@ public class CaptchaCommandTest {
|
||||
verifyNoMoreInteractions(captchaManager);
|
||||
verify(commandService).send(player, MessageKey.CAPTCHA_SUCCESS);
|
||||
verify(commandService).send(player, MessageKey.LOGIN_MESSAGE);
|
||||
verify(messageTask).setMuted(false);
|
||||
verifyNoMoreInteractions(commandService);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user