From 9eeb510b084ba6dd9fc029f7398d1120dbdc7682 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Thu, 31 Dec 2015 12:20:48 +0700 Subject: [PATCH] Messing up the test. --- .../authme/security/PasswordSecurityTest.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java b/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java index 8c1edffd5..f18a05707 100644 --- a/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java +++ b/src/test/java/fr/xephi/authme/security/PasswordSecurityTest.java @@ -70,9 +70,7 @@ public class PasswordSecurityTest { String playerLowerCase = playerName.toLowerCase(); String clearTextPass = "myPassTest"; - PlayerAuth auth = mock(PlayerAuth.class); - given(auth.getPassword()).willReturn(password); - given(dataSource.getAuth(playerName)).willReturn(auth); + given(dataSource.getPassword(playerName)).willReturn(password); given(method.comparePassword(clearTextPass, password, playerLowerCase)).willReturn(true); PasswordSecurity security = new PasswordSecurity(dataSource, HashAlgorithm.BCRYPT, pluginManager, false); @@ -81,7 +79,7 @@ public class PasswordSecurityTest { // then assertThat(result, equalTo(true)); - verify(dataSource).getAuth(playerName); + verify(dataSource).getPassword(playerName); verify(pluginManager).callEvent(any(PasswordEncryptionEvent.class)); verify(method).comparePassword(clearTextPass, password, playerLowerCase); } @@ -95,8 +93,7 @@ public class PasswordSecurityTest { String clearTextPass = "passw0Rd1"; PlayerAuth auth = mock(PlayerAuth.class); - given(auth.getPassword()).willReturn(password); - given(dataSource.getAuth(playerName)).willReturn(auth); + given(dataSource.getPassword(playerName)).willReturn(password); given(method.comparePassword(clearTextPass, password, playerLowerCase)).willReturn(false); PasswordSecurity security = new PasswordSecurity(dataSource, HashAlgorithm.CUSTOM, pluginManager, false); @@ -105,7 +102,7 @@ public class PasswordSecurityTest { // then assertThat(result, equalTo(false)); - verify(dataSource).getAuth(playerName); + verify(dataSource).getPassword(playerName); verify(pluginManager).callEvent(any(PasswordEncryptionEvent.class)); verify(method).comparePassword(clearTextPass, password, playerLowerCase); } @@ -116,7 +113,7 @@ public class PasswordSecurityTest { String playerName = "bobby"; String clearTextPass = "tables"; - given(dataSource.getAuth(playerName)).willReturn(null); + given(dataSource.getPassword(playerName)).willReturn(null); PasswordSecurity security = new PasswordSecurity(dataSource, HashAlgorithm.MD5, pluginManager, false); // when @@ -124,7 +121,7 @@ public class PasswordSecurityTest { // then assertThat(result, equalTo(false)); - verify(dataSource).getAuth(playerName); + verify(dataSource).getPassword(playerName); verify(pluginManager, never()).callEvent(any(Event.class)); verify(method, never()).comparePassword(anyString(), any(HashedPassword.class), anyString()); }