85a11d4d5179aa866027879e50019d642f2ac020
[policy/engine.git] / ONAP-REST / src / test / java / org / onap / policy / rest / util / MSAttributeObjectTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
4  * ================================================================================
5  * Copyright (C) 2018 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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20 package org.onap.policy.rest.util;
21
22 import static org.junit.Assert.assertTrue;
23
24 import java.util.HashMap;
25
26 import org.junit.Test;
27
28 public class MSAttributeObjectTest {
29
30         @Test
31         public void testMSAttributeObject(){
32                 MSAttributeObject data = new MSAttributeObject();
33                 data.setClassName("Test");
34                 assertTrue("Test".equals(data.getClassName()));
35                 data.setRefAttribute(new HashMap<>());
36                 assertTrue(data.getRefAttribute()!=null);
37                 data.setAttribute(new HashMap<>());
38                 assertTrue(data.getAttribute()!=null);
39                 data.setEnumType(new HashMap<>());
40                 assertTrue(data.getEnumType()!=null);
41                 data.addAttribute("test", "test");
42                 data.addRefAttribute("test", "test");
43                 data.addAllAttribute(new HashMap<>());
44                 data.addAllRefAttribute(new HashMap<>());
45                 data.setSubClass(new HashMap<>());
46                 assertTrue(data.getSubClass()!=null);
47                 data.addAllSubClass(new HashMap<>());
48                 data.setDependency("Test");
49                 assertTrue("Test".equals(data.getDependency()));
50                 data.addSingleEnum("test", "test");
51                 data.setMatchingSet(new HashMap<>());
52                 assertTrue(data.getMatchingSet()!=null);
53                 data.addMatchingSet("test", "test");
54                 data.addMatchingSet(new HashMap<>());
55                 data.setPolicyTempalate(true);
56                 assertTrue(data.isPolicyTempalate());
57         }
58         
59         @Test
60         public void testMSAttributeValue(){
61                 MSAttributeValue data = new MSAttributeValue();
62                 data.setName("Test");
63                 assertTrue("Test".equals(data.getName()));
64                 data.setType("Test");
65                 assertTrue("Test".equals(data.getType()));
66                 data.setRequired(true);
67                 assertTrue(data.getRequired());
68                 data.setArrayValue(true);
69                 assertTrue(data.getArrayValue());
70                 data.setDefaultValue("Test");
71                 assertTrue("Test".equals(data.getDefaultValue()));
72         }
73 }