Reformat PolicyEngineAPI test cases
[policy/engine.git] / PolicyEngineAPI / src / test / java / org / onap / policy / test / APIPolicyConfigResponseTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
4  * ================================================================================
5  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Modifications Copyright (C) 2019 Samsung
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.policy.test;
24
25 import java.util.HashMap;
26 import java.util.Map;
27 import org.junit.Test;
28 import org.onap.policy.api.PolicyConfigStatus;
29 import org.onap.policy.api.PolicyConfigType;
30 import org.onap.policy.api.PolicyType;
31 import org.onap.policy.models.APIPolicyConfigResponse;
32 import junit.framework.TestCase;
33
34 public class APIPolicyConfigResponseTest extends TestCase {
35     private final String testKey = "testKey";
36     private final String testValue = "testValue";
37     private final PolicyType testType = PolicyType.JSON;
38     private final PolicyConfigStatus testStatus = PolicyConfigStatus.CONFIG_RETRIEVED;
39     private final PolicyConfigType testConfigType = PolicyConfigType.BRMS_PARAM;
40
41     @Test
42     public final void testSetAndGet() {
43         APIPolicyConfigResponse response = new APIPolicyConfigResponse();
44         response.setConfig(testValue);
45         assertEquals(response.getConfig(), testValue);
46
47         response.setType(testType);
48         assertEquals(response.getType(), testType);
49
50         response.setPolicyConfigStatus(testStatus);
51         assertEquals(response.getPolicyConfigStatus(), testStatus);
52
53         response.setPolicyConfigMessage(testValue);
54         assertEquals(response.getPolicyConfigMessage(), testValue);
55
56         response.setPolicyName(testValue);
57         assertEquals(response.getPolicyName(), testValue);
58
59         response.setPolicyType(testConfigType);
60         assertEquals(response.getPolicyType(), testConfigType);
61
62         response.setPolicyVersion(testValue);
63         assertEquals(response.getPolicyVersion(), testValue);
64
65         Map<String, String> testMap = new HashMap<String, String>();
66         testMap.put(testKey, testValue);
67
68         response.setMatchingConditions(testMap);
69         assertEquals(response.getMatchingConditions(), testMap);
70
71         response.setProperty(testMap);
72         assertEquals(response.getProperty(), testMap);
73
74         response.setResponseAttributes(testMap);
75         assertEquals(response.getResponseAttributes(), testMap);
76     }
77 }