Sonar Fixes to increate Coverage on Unit tests
[music.git] / src / test / java / org / onap / music / unittests / jsonobjects / JsonUpdateTest.java
1 /*******************************************************************************
2  * ============LICENSE_START==========================================
3  * org.onap.music
4  * ===================================================================
5  *  Copyright (c) 2018 AT&T Intellectual Property
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  *  
19  * ============LICENSE_END=============================================
20  * ====================================================================
21  *******************************************************************************/
22 package org.onap.music.unittests.jsonobjects;
23
24 import static org.junit.Assert.*;
25 import java.util.HashMap;
26 import java.util.Map;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.onap.music.datastore.jsonobjects.JsonUpdate;
30
31 public class JsonUpdateTest {
32     
33     JsonUpdate ju = null;
34     
35     @Before
36     public void init() {
37         ju = new JsonUpdate();
38     }
39     
40
41     @Test
42     public void testGetConditions() {
43         Map<String,Object>  mapSo = new HashMap<>();
44         mapSo.put("key1","one");
45         mapSo.put("key2","two");
46         ju.setConditions(mapSo);
47         assertEquals("one",ju.getConditions().get("key1"));
48     }
49
50     @Test
51     public void testGetRow_specification() {
52         Map<String,Object>  mapSo = new HashMap<>();
53         mapSo.put("key1","one");
54         mapSo.put("key2","two");
55         ju.setRow_specification(mapSo);
56         assertEquals("one",ju.getRow_specification().get("key1"));
57     }
58
59     @Test
60     public void testGetKeyspaceName() {
61         String keyspace = "keyspace";
62         ju.setKeyspaceName(keyspace);
63         assertEquals(keyspace,ju.getKeyspaceName());
64     }
65
66     @Test
67     public void testGetTableName() {
68         String table = "table";
69         ju.setTableName(table);
70         assertEquals(table,ju.getTableName());
71    }
72
73     @Test
74     public void testGetConsistencyInfo() {
75         Map<String, String> mapSs = new HashMap<>();
76         mapSs.put("k1", "one");
77         ju.setConsistencyInfo(mapSs);
78         assertEquals("one",ju.getConsistencyInfo().get("k1"));
79     }
80
81     @Test
82     public void testGetTtl() {
83         ju.setTtl("2000");
84         assertEquals("2000",ju.getTtl());
85     }
86
87     @Test
88     public void testGetTimestamp() {
89         ju.setTimestamp("20:00");
90         assertEquals("20:00",ju.getTimestamp());
91
92     }
93
94     @Test
95     public void testGetValues() {
96         Map<String,Object> cons = new HashMap<>();
97         cons.put("val1","one");
98         cons.put("val2","two");
99         ju.setValues(cons);
100         assertEquals("one",ju.getValues().get("val1"));
101     }
102
103 }