Update junits
[music.git] / music-core / src / test / java / org / onap / music / main / ReturnTypeTest.java
1 /*
2  * ============LICENSE_START==========================================
3  * org.onap.music
4  * ===================================================================
5  *  Copyright (c) 2017 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
23 package org.onap.music.main;
24
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.assertTrue;
27
28 import java.util.Map;
29
30 import org.junit.Test;
31
32 public class ReturnTypeTest {
33
34     @Test
35     public void testReturnType() {
36         ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
37         assertEquals(result.getMessage(),"message");
38         assertEquals(result.getResult(),ResultType.SUCCESS);
39     }
40
41     @Test
42     public void testTimingInfo() {
43         ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
44         result.setTimingInfo("123");
45         assertEquals(result.getTimingInfo(),"123");
46     }
47
48     @Test
49     public void testGetResult() {
50         ReturnType result = new ReturnType(ResultType.FAILURE,"message");
51         assertEquals(result.getResult(),ResultType.FAILURE);
52     }
53
54     @Test
55     public void testGetMessage() {
56         ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
57         result.setMessage("NewMessage");
58         assertEquals(result.getMessage(),"NewMessage");
59     }
60
61     @Test
62     public void testToJson() {
63         ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
64         String myJson = result.toJson();
65         assertTrue(myJson.contains("message"));
66     }
67
68     @Test
69     public void testToString() {
70         ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
71         String test = result.toString();
72         assertTrue(test.contains("message"));
73     }
74
75     @Test
76     public void testToMap() {
77         ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
78         Map<String, Object> myMap = result.toMap();
79         assertTrue(myMap.containsKey("message"));
80     }
81
82 }