2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2018 Nokia Solutions and Networks
8 * =============================================================================
9 * Modifications Copyright (C) 2019 IBM.
10 * =============================================================================
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
23 * ============LICENSE_END=========================================================
25 package org.onap.appc.listener.LCM.model;
27 import static org.junit.Assert.assertEquals;
28 import static org.junit.Assert.assertFalse;
29 import static org.junit.Assert.assertTrue;
30 import static org.onap.appc.listener.TestUtil.buildActionIdentifiers;
31 import static org.onap.appc.listener.TestUtil.buildCommonHeader;
33 import org.junit.Before;
34 import org.junit.Test;
36 public class InputBodyTest {
38 private InputBody inputBody;
42 inputBody = new InputBody();
46 public void should_set_properties() {
48 CommonHeader testCommonHeader = buildCommonHeader();
49 ActionIdentifiers testActionIdentifiers = buildActionIdentifiers();
51 inputBody.setCommonHeader(testCommonHeader);
52 inputBody.setActionIdentifiers(testActionIdentifiers);
53 inputBody.setAction("test-action");
54 inputBody.setPayload("{\"payload\": \"value\"");
56 assertEquals(testCommonHeader, inputBody.getCommonHeader());
57 assertEquals(testActionIdentifiers, inputBody.getActionIdentifiers());
58 assertEquals("test-action", inputBody.getAction());
59 assertEquals("{\"payload\": \"value\"", inputBody.getPayload());
63 public void should_verify_if_is_valid() {
65 assertFalse(inputBody.isValid());
66 inputBody.setCommonHeader(buildCommonHeader());
67 assertTrue(inputBody.isValid());
71 public void testPayLoadAsString()
73 inputBody.setPayloadAsString("payload");
74 assertEquals("payload", inputBody.getPayload());