summaryrefslogtreecommitdiffstats
path: root/security-utils/src/test
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-07-29 16:13:45 +0300
committerMichael Lando <ml636r@att.com>2018-07-29 16:20:34 +0300
commit5b593496b8f1b8e8be8d7d2dbcc223332e65a49b (patch)
tree2f9dfc45191e723da69cf74be7829784e9741b94 /security-utils/src/test
parent9200382f2ce7b4bb729aa287d0878004b2d2b4f9 (diff)
re base code
Change-Id: I12a5ca14a6d8a87e9316b9ff362eb131105f98a5 Issue-ID: SDC-1566 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'security-utils/src/test')
-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 {