Fix test unit

This commit is contained in:
DNx5 2015-11-26 11:04:12 +07:00
parent 7a78b321e7
commit d7ae2a96e3
2 changed files with 8 additions and 8 deletions

View File

@ -94,11 +94,11 @@ public class Messages extends CustomConfiguration {
* *
* @return The message * @return The message
*/ */
private static String[] retrieve(String key) { private String[] retrieve(String key) {
if (!Settings.messagesLanguage.equalsIgnoreCase(singleton.language)) { if (!Settings.messagesLanguage.equalsIgnoreCase(language)) {
singleton.reloadMessages(); reloadMessages();
} }
String message = (String) singleton.get(key); String message = (String) get(key);
if (message != null) { if (message != null) {
return formatMessage(message); 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 // Message is null: log key not being found and send error back as message
String retrievalError = "Error getting message with key '" + key + "'. "; String retrievalError = "Error getting message with key '" + key + "'. ";
ConsoleLogger.showError(retrievalError + "Please verify your config file at '" ConsoleLogger.showError(retrievalError + "Please verify your config file at '"
+ singleton.getConfigFile().getName() + "'"); + getConfigFile().getName() + "'");
return new String[]{ return new String[]{
retrievalError + "Please contact the admin to verify or update the AuthMe messages file."}; retrievalError + "Please contact the admin to verify or update the AuthMe messages file."};
} }

View File

@ -33,12 +33,12 @@ public class RegisterCommandTest {
@Before @Before
public void initializeAuthMeMock() { public void initializeAuthMeMock() {
AuthMeMockUtil.mockMessagesInstance();
messagesMock = Messages.getInstance();
AuthMeMockUtil.mockAuthMeInstance(); AuthMeMockUtil.mockAuthMeInstance();
AuthMe pluginMock = AuthMe.getInstance(); AuthMe pluginMock = AuthMe.getInstance();
messagesMock = mock(Messages.class);
Mockito.when(pluginMock.getMessages()).thenReturn(messagesMock);
Settings.captchaLength = 10; Settings.captchaLength = 10;
managementMock = mock(Management.class); managementMock = mock(Management.class);
Mockito.when(pluginMock.getManagement()).thenReturn(managementMock); Mockito.when(pluginMock.getManagement()).thenReturn(managementMock);