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
*/
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."};
}

View File

@ -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);