2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018-2019 AT&T Intellectual Property. 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=========================================================
21 package org.onap.policy.rest.util;
23 import static org.junit.Assert.assertTrue;
24 import java.util.HashMap;
25 import org.junit.Test;
27 public class MSAttributeObjectTest {
30 public void testMSAttributeObject() {
31 MSAttributeObject data = new MSAttributeObject();
32 data.setClassName("Test");
33 assertTrue("Test".equals(data.getClassName()));
34 data.setRefAttribute(new HashMap<>());
35 assertTrue(data.getRefAttribute() != null);
36 data.setAttribute(new HashMap<>());
37 assertTrue(data.getAttribute() != null);
38 data.setEnumType(new HashMap<>());
39 assertTrue(data.getEnumType() != null);
40 data.addAttribute("test", "test");
41 data.addRefAttribute("test", "test");
42 data.addAllAttribute(new HashMap<>());
43 data.addAllRefAttribute(new HashMap<>());
44 data.setSubClass(new HashMap<>());
45 assertTrue(data.getSubClass() != null);
46 data.addAllSubClass(new HashMap<>());
47 data.setDependency("Test");
48 assertTrue("Test".equals(data.getDependency()));
49 data.addSingleEnum("test", "test");
50 data.setMatchingSet(new HashMap<>());
51 assertTrue(data.getMatchingSet() != null);
52 data.addMatchingSet("test", "test");
53 data.addMatchingSet(new HashMap<>());
54 data.setPolicyTempalate(true);
55 assertTrue(data.isPolicyTempalate());
56 data.setRuleFormation("ruleFormation");
57 assertTrue(data.getRuleFormation() != null);
58 data.setDataOrderInfo("dataOrderInfo");
59 assertTrue(data.getDataOrderInfo() != null);
63 public void testMSAttributeValue() {
64 MSAttributeValue data = new MSAttributeValue();
66 assertTrue("Test".equals(data.getName()));
68 assertTrue("Test".equals(data.getType()));
69 data.setRequired(true);
70 assertTrue(data.getRequired());
71 data.setArrayValue(true);
72 assertTrue(data.getArrayValue());
73 data.setDefaultValue("Test");
74 assertTrue("Test".equals(data.getDefaultValue()));