2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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
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.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.appclcm;
23 import static org.junit.Assert.*;
25 import org.junit.Test;
27 public class TestLCMResponseStatus {
30 public void testResonseStatus() {
31 LCMResponseStatus status = new LCMResponseStatus();
32 assertNotNull(status);
33 assertNotEquals(0, status.hashCode());
36 assertEquals(1234, status.getCode());
38 status.setMessage("The wonderful land of Oz");
39 assertEquals("The wonderful land of Oz", status.getMessage());
41 assertEquals("ResponseStatus [code=1234, message=The wonderfu", status.toString().substring(0, 47));
43 LCMResponseStatus copiedStatus = new LCMResponseStatus();
44 copiedStatus.setCode(status.getCode());
45 copiedStatus.setMessage(status.getMessage());
47 assertTrue(status.equals(status));
48 assertTrue(status.equals(copiedStatus));
49 assertFalse(status.equals(null));
50 assertFalse(status.equals("Hello"));
53 assertFalse(status.equals(copiedStatus));
54 copiedStatus.setCode(-1);
55 assertTrue(status.equals(copiedStatus));
57 assertFalse(status.equals(copiedStatus));
58 copiedStatus.setCode(1234);
59 assertTrue(status.equals(copiedStatus));
61 status.setMessage(null);
62 assertFalse(status.equals(copiedStatus));
63 copiedStatus.setMessage(null);
64 assertTrue(status.equals(copiedStatus));
65 status.setMessage("The wonderful land of Oz");
66 assertFalse(status.equals(copiedStatus));
67 copiedStatus.setMessage("The wonderful land of Oz");
68 assertTrue(status.equals(copiedStatus));