diff options
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util')
-rw-r--r-- | ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java index b35a1cda..4357b0a5 100644 --- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java @@ -41,20 +41,21 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import javax.xml.bind.DatatypeConverter; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.onap.portalsdk.core.onboarding.util.CipherUtil; -import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.http.HttpHeaders; @RunWith(PowerMockRunner.class) -@PrepareForTest({ EcompExternalAuthProperties.class, CipherUtil.class }) +@PrepareForTest({ EcompExternalAuthProperties.class, CipherUtil.class, DatatypeConverter.class }) public class EcompExternalAuthUtilsTest { public static final String EXT_EMPTY_JSON_STRING = "{}"; @@ -73,6 +74,7 @@ public class EcompExternalAuthUtilsTest { public void setup() { PowerMockito.mockStatic(EcompExternalAuthProperties.class); PowerMockito.mockStatic(CipherUtil.class); + PowerMockito.mockStatic(DatatypeConverter.class); Mockito.when(EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_USER_NAME)) .thenReturn("test_username"); Mockito.when(EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_PASSWORD)) @@ -82,19 +84,15 @@ public class EcompExternalAuthUtilsTest { @Test public void base64encodeKeyForAAFBasicAuthTest() throws Exception { - Mockito.when( - CipherUtil.decryptPKC("test_password", SystemProperties.getProperty(SystemProperties.Decryption_Key))) - .thenReturn("test_decrypted_password"); - HttpHeaders actual = EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth(); + HttpHeaders actual = EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth("test", "test"); assertNotNull(actual); } @Test(expected = NullPointerException.class) public void base64encodeKeyForAAFBasicAuthDecryptPassExceptionTest() throws Exception { - Mockito.when( - CipherUtil.decryptPKC("test_password", SystemProperties.getProperty(SystemProperties.Decryption_Key))) + Mockito.when(DatatypeConverter.printBase64Binary("test:test".getBytes())) .thenThrow(new NullPointerException()); - EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth(); + EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth("test", "test"); } @Test |