aboutsummaryrefslogtreecommitdiffstats
path: root/security-utils/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'security-utils/src/test/java/org')
-rw-r--r--security-utils/src/test/java/org/openecomp/sdc/security/PasswordsTest.java38
-rw-r--r--security-utils/src/test/java/org/openecomp/sdc/security/SecurityUtilTest.java5
2 files changed, 24 insertions, 19 deletions
diff --git a/security-utils/src/test/java/org/openecomp/sdc/security/PasswordsTest.java b/security-utils/src/test/java/org/openecomp/sdc/security/PasswordsTest.java
index 26f04735e5..6d6e3cea8a 100644
--- a/security-utils/src/test/java/org/openecomp/sdc/security/PasswordsTest.java
+++ b/security-utils/src/test/java/org/openecomp/sdc/security/PasswordsTest.java
@@ -2,53 +2,55 @@ package org.openecomp.sdc.security;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
public class PasswordsTest {
@Test
public void hashPassword() throws Exception {
String hash = Passwords.hashPassword("hello1234");
- assertEquals(true, Passwords.isExpectedPassword("hello1234", hash));
+ assertTrue(Passwords.isExpectedPassword("hello1234", hash));
//test different salt-> result in different hash
String hash2 = Passwords.hashPassword("hello1234");
- assertEquals(false, hash.equals(hash2));
+ assertFalse(hash.equals(hash2));
String hash3 = Passwords.hashPassword("");
- assertEquals(true, Passwords.isExpectedPassword("", hash3));
+ assertTrue(Passwords.isExpectedPassword("", hash3));
String hash4 = Passwords.hashPassword(null);
- assertEquals(true, hash4 == null );
+ assertTrue(hash4 == null);
}
@Test
public void isExpectedPassword() throws Exception {
//region isExpectedPassword(String password, String salt, String hash)
- assertEquals(true, Passwords.isExpectedPassword(null, null , null));
+ assertTrue(Passwords.isExpectedPassword(null, null, null));
//valid hash
- assertEquals(true, Passwords.isExpectedPassword("hello1234", "e0277df331f4ff8f74752ac4a8fbe03b","6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
+ assertTrue(Passwords.isExpectedPassword("hello1234", "e0277df331f4ff8f74752ac4a8fbe03b", "6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
//invalid salt
- assertEquals(false, Passwords.isExpectedPassword("hello1234", "c0000df331f4ff8f74752ac4a00be03c","6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
- assertEquals(false, Passwords.isExpectedPassword("hello1234", null,"6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
+ assertFalse(Passwords.isExpectedPassword("hello1234", "c0000df331f4ff8f74752ac4a00be03c", "6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
+ assertFalse(Passwords.isExpectedPassword("hello1234", null, "6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
//exacly 1 param uninitialized
- assertEquals(false,Passwords.isExpectedPassword("hello1234", "",null));
- assertEquals(false,Passwords.isExpectedPassword( null, "" , "hello1234"));
+ assertFalse(Passwords.isExpectedPassword("hello1234", "", null));
+ assertFalse(Passwords.isExpectedPassword(null, "", "hello1234"));
//no salt & no hash
- assertEquals(false, Passwords.isExpectedPassword("hello1234", null ,"hello1234"));
+ assertFalse(Passwords.isExpectedPassword("hello1234", null, "hello1234"));
//endregion
//region isExpectedPassword(String password, String expectedHash)
- assertEquals(true, Passwords.isExpectedPassword(null, null));
+ assertTrue(Passwords.isExpectedPassword(null, null));
//valid hash
- assertEquals(true, Passwords.isExpectedPassword("hello1234", "e0277df331f4ff8f74752ac4a8fbe03b:6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
+ assertTrue(Passwords.isExpectedPassword("hello1234", "e0277df331f4ff8f74752ac4a8fbe03b:6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
//invalid salt
- assertEquals(false, Passwords.isExpectedPassword("hello1234", "c0000df331f4ff8f74752ac4a00be03c:6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
+ assertFalse(Passwords.isExpectedPassword("hello1234", "c0000df331f4ff8f74752ac4a00be03c:6dfbad308cdf53c9ff2ee2dca811ee92f1b359586b33027580e2ff92578edbd0"));
//exacly 1 param uninitialized
- assertEquals(false,Passwords.isExpectedPassword("hello1234", null));
- assertEquals(false,Passwords.isExpectedPassword( null,"hello1234"));
+ assertFalse(Passwords.isExpectedPassword("hello1234", null));
+ assertFalse(Passwords.isExpectedPassword(null, "hello1234"));
//no salt & no hash
- assertEquals(false, Passwords.isExpectedPassword("hello1234", "hello1234"));
+ assertFalse(Passwords.isExpectedPassword("hello1234", "hello1234"));
//endregion
}
diff --git a/security-utils/src/test/java/org/openecomp/sdc/security/SecurityUtilTest.java b/security-utils/src/test/java/org/openecomp/sdc/security/SecurityUtilTest.java
index e23c864b77..a5cdff7bc1 100644
--- a/security-utils/src/test/java/org/openecomp/sdc/security/SecurityUtilTest.java
+++ b/security-utils/src/test/java/org/openecomp/sdc/security/SecurityUtilTest.java
@@ -1,8 +1,11 @@
package org.openecomp.sdc.security;
import org.junit.Test;
+
import java.util.Base64;
-import static org.junit.Assert.*;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
public class SecurityUtilTest {