2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (c) 2019 Samsung. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.so.apihandler.common;
22 import org.junit.Assert;
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.junit.runner.RunWith;
26 import org.mockito.Mockito;
27 import org.mockito.junit.MockitoJUnitRunner;
29 @RunWith(MockitoJUnitRunner.class)
30 public class RequestClientTest {
32 private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
34 private RequestClient requestClient;
38 requestClient = Mockito.mock(RequestClient.class, Mockito.CALLS_REAL_METHODS);
42 public void getEncryptedPropValueWithSuccess() {
44 String encryptedValue = requestClient.getEncryptedPropValue(
45 "E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE",
46 "defaultValue", ENCRYPTION_KEY);
48 Assert.assertEquals("apihBpmn:camunda-R1512!", encryptedValue);
52 public void getDefaultEncryptedPropValue() {
54 String encryptedValue =
55 requestClient.getEncryptedPropValue("012345678901234567890123456789", "defaultValue", ENCRYPTION_KEY);
57 Assert.assertEquals("defaultValue", encryptedValue);