Add missing unit tests for commands

This commit is contained in:
ljacqu
2016-06-05 13:21:05 +02:00
parent a5a796e900
commit 2e269b6f5e
7 changed files with 602 additions and 2 deletions
@@ -1,5 +1,6 @@
package fr.xephi.authme.command.executable.authme;
import com.google.common.annotations.VisibleForTesting;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.converter.Converter;
@@ -58,7 +59,8 @@ public class ConverterCommand implements ExecutableCommand {
sender.sendMessage("[AuthMe] Successfully converted from " + jobType.getName());
}
private enum ConvertType {
@VisibleForTesting
enum ConvertType {
XAUTH("xauth", xAuthConverter.class),
CRAZYLOGIN("crazylogin", CrazyLoginConverter.class),
RAKAMAK("rakamak", RakamakConverter.class),
@@ -18,13 +18,16 @@ public class UnregisterCommand extends PlayerCommand {
@Inject
private CommandService commandService;
@Inject
private PlayerCache playerCache;
@Override
public void runCommand(Player player, List<String> arguments) {
String playerPass = arguments.get(0);
final String playerNameLowerCase = player.getName().toLowerCase();
// Make sure the player is authenticated
if (!PlayerCache.getInstance().isAuthenticated(playerNameLowerCase)) {
if (!playerCache.isAuthenticated(playerNameLowerCase)) {
commandService.send(player, MessageKey.NOT_LOGGED_IN);
return;
}