Testing - change to non-reflection WrapperMock test setup
Replaced many classes to use Wrapper to get singletons and replaced the test setups to use the WrapperMock instead of setting fields through reflection
This commit is contained in:
@@ -3,6 +3,7 @@ package fr.xephi.authme.command.executable.email;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.util.Wrapper;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -22,7 +23,7 @@ public class AddEmailCommand extends ExecutableCommand {
|
||||
String playerMailVerify = commandArguments.get(1);
|
||||
|
||||
// Get the player and perform email addition
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
final AuthMe plugin = Wrapper.getInstance().getAuthMe();
|
||||
final Player player = (Player) sender;
|
||||
plugin.getManagement().performAddEmail(player, playerMail, playerMailVerify);
|
||||
return true;
|
||||
|
||||
@@ -3,6 +3,7 @@ package fr.xephi.authme.command.executable.email;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.util.Wrapper;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -22,7 +23,7 @@ public class ChangeEmailCommand extends ExecutableCommand {
|
||||
String playerMailNew = commandArguments.get(1);
|
||||
|
||||
// Get the player instance and execute action
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
final AuthMe plugin = Wrapper.getInstance().getAuthMe();
|
||||
final Player player = (Player) sender;
|
||||
plugin.getManagement().performChangeEmail(player, playerMailOld, playerMailNew);
|
||||
return true;
|
||||
|
||||
@@ -11,6 +11,7 @@ import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.settings.MessageKey;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.util.Wrapper;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -35,8 +36,9 @@ public class RecoverEmailCommand extends ExecutableCommand {
|
||||
final String playerName = player.getName();
|
||||
|
||||
// Command logic
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
final Wrapper wrapper = Wrapper.getInstance();
|
||||
final AuthMe plugin = wrapper.getAuthMe();
|
||||
final Messages m = wrapper.getMessages();
|
||||
|
||||
if (plugin.mail == null) {
|
||||
m.send(player, MessageKey.ERROR);
|
||||
|
||||
Reference in New Issue
Block a user