2 * ============LICENSE_START==========================================
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
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.
19 * ============LICENSE_END=============================================
20 * ====================================================================
23 package org.onap.music.main;
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.assertTrue;
30 import org.junit.Test;
32 public class ReturnTypeTest {
35 public void testReturnType() {
36 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
37 assertEquals(result.getMessage(),"message");
38 assertEquals(result.getResult(),ResultType.SUCCESS);
42 public void testTimingInfo() {
43 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
44 result.setTimingInfo("123");
45 assertEquals(result.getTimingInfo(),"123");
49 public void testGetResult() {
50 ReturnType result = new ReturnType(ResultType.FAILURE,"message");
51 assertEquals(result.getResult(),ResultType.FAILURE);
55 public void testGetMessage() {
56 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
57 result.setMessage("NewMessage");
58 assertEquals(result.getMessage(),"NewMessage");
62 public void testToJson() {
63 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
64 String myJson = result.toJson();
65 assertTrue(myJson.contains("message"));
69 public void testToString() {
70 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
71 String test = result.toString();
72 assertTrue(test.contains("message"));
76 public void testToMap() {
77 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
78 Map<String, Object> myMap = result.toMap();
79 assertTrue(myMap.containsKey("message"));