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.unittests;
25 import static org.junit.Assert.*;
27 import org.apache.tools.ant.filters.TokenFilter.ContainsString;
28 import org.hamcrest.core.AnyOf;
29 import org.junit.Test;
30 import org.onap.music.main.ResultType;
31 import org.onap.music.main.ReturnType;
33 public class ReturnTypeTest {
36 public void testReturnType() {
37 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
38 assertEquals(result.getMessage(),"message");
39 assertEquals(result.getResult(),ResultType.SUCCESS);
43 public void testTimingInfo() {
44 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
45 result.setTimingInfo("123");
46 assertEquals(result.getTimingInfo(),"123");
50 public void testGetResult() {
51 ReturnType result = new ReturnType(ResultType.FAILURE,"message");
52 assertEquals(result.getResult(),ResultType.FAILURE);
56 public void testGetMessage() {
57 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
58 result.setMessage("NewMessage");
59 assertEquals(result.getMessage(),"NewMessage");
63 public void testToJson() {
64 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
65 String myJson = result.toJson();
66 assertTrue(myJson.contains("message"));
70 public void testToString() {
71 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
72 String test = result.toString();
73 assertTrue(test.contains("message"));
77 public void testToMap() {
78 ReturnType result = new ReturnType(ResultType.SUCCESS,"message");
79 Map<String, Object> myMap = result.toMap();
80 assertTrue(myMap.containsKey("message"));