diff --git a/src/main/java/fr/xephi/authme/settings/Messages.java b/src/main/java/fr/xephi/authme/settings/Messages.java index e603c317d..6e7becae5 100644 --- a/src/main/java/fr/xephi/authme/settings/Messages.java +++ b/src/main/java/fr/xephi/authme/settings/Messages.java @@ -94,11 +94,11 @@ public class Messages extends CustomConfiguration { * * @return The message */ - private static String[] retrieve(String key) { - if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.language)) { - singleton.reloadMessages(); + private String[] retrieve(String key) { + if (!Settings.messagesLanguage.equalsIgnoreCase(language)) { + reloadMessages(); } - String message = (String) singleton.get(key); + String message = (String) get(key); if (message != null) { return formatMessage(message); } @@ -106,7 +106,7 @@ public class Messages extends CustomConfiguration { // Message is null: log key not being found and send error back as message String retrievalError = "Error getting message with key '" + key + "'. "; ConsoleLogger.showError(retrievalError + "Please verify your config file at '" - + singleton.getConfigFile().getName() + "'"); + + getConfigFile().getName() + "'"); return new String[]{ retrievalError + "Please contact the admin to verify or update the AuthMe messages file."}; } diff --git a/src/test/java/fr/xephi/authme/command/executable/register/RegisterCommandTest.java b/src/test/java/fr/xephi/authme/command/executable/register/RegisterCommandTest.java index b408e43cd..6d089870d 100644 --- a/src/test/java/fr/xephi/authme/command/executable/register/RegisterCommandTest.java +++ b/src/test/java/fr/xephi/authme/command/executable/register/RegisterCommandTest.java @@ -33,12 +33,12 @@ public class RegisterCommandTest { @Before public void initializeAuthMeMock() { - AuthMeMockUtil.mockMessagesInstance(); - messagesMock = Messages.getInstance(); - AuthMeMockUtil.mockAuthMeInstance(); AuthMe pluginMock = AuthMe.getInstance(); + messagesMock = mock(Messages.class); + Mockito.when(pluginMock.getMessages()).thenReturn(messagesMock); + Settings.captchaLength = 10; managementMock = mock(Management.class); Mockito.when(pluginMock.getManagement()).thenReturn(managementMock);