2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 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.assertEquals;
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertNotEquals;
26 import static org.junit.Assert.assertNotNull;
27 import static org.junit.Assert.assertTrue;
29 import org.junit.Test;
31 public class LcmResponseStatusTest {
34 public void testResonseStatus() {
35 LcmResponseStatus status = new LcmResponseStatus();
36 assertNotNull(status);
37 assertNotEquals(0, status.hashCode());
40 assertEquals(1234, status.getCode());
42 status.setMessage("The wonderful land of Oz");
43 assertEquals("The wonderful land of Oz", status.getMessage());
45 assertEquals("ResponseStatus [code=1234, message=The wonderfu", status.toString().substring(0, 47));
47 LcmResponseStatus copiedStatus = new LcmResponseStatus();
48 copiedStatus.setCode(status.getCode());
49 copiedStatus.setMessage(status.getMessage());
51 assertTrue(status.equals(status));
52 assertTrue(status.equals(copiedStatus));
53 assertFalse(status.equals(null));
54 assertFalse(status.equals("Hello"));
57 assertFalse(status.equals(copiedStatus));
58 copiedStatus.setCode(-1);
59 assertTrue(status.equals(copiedStatus));
61 assertFalse(status.equals(copiedStatus));
62 copiedStatus.setCode(1234);
63 assertTrue(status.equals(copiedStatus));
65 status.setMessage(null);
66 assertFalse(status.equals(copiedStatus));
67 copiedStatus.setMessage(null);
68 assertTrue(status.equals(copiedStatus));
69 status.setMessage("The wonderful land of Oz");
70 assertFalse(status.equals(copiedStatus));
71 copiedStatus.setMessage("The wonderful land of Oz");
72 assertTrue(status.equals(copiedStatus));