diff options
author | Pawel Kadlubanski <pawel.kadlubanski@nokia.com> | 2018-05-28 11:34:50 +0200 |
---|---|---|
committer | Pawel Kadlubanski <pawel.kadlubanski@nokia.com> | 2018-05-28 11:35:31 +0200 |
commit | ae2335539459822eda2abf66b6062aae0795ad24 (patch) | |
tree | 962305468f9fca658bae78d35c314e2724e2a942 /test/mocks/pnfsimulator/src/test/java/org | |
parent | b2341a5b10c1dd57f19fdeb8fd19ed820dcaa2eb (diff) |
Correction in created message.
Issue-ID: INT-458
Change-Id: Ic66e27bc89eea194769d54dd367a9a09d484d87f
Signed-off-by: Pawel Kadlubanski <pawel.kadlubanski@nokia.com>
Diffstat (limited to 'test/mocks/pnfsimulator/src/test/java/org')
-rw-r--r-- | test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java index 38540577e..bfd222dc2 100644 --- a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java +++ b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/message/MessageProviderTest.java @@ -1,22 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * org.onap.integration + * ================================================================================ + * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.pnfsimulator.message; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.onap.pnfsimulator.message.MessageConstants.COMMON_EVENT_HEADER; -import static org.onap.pnfsimulator.message.MessageConstants.DOMAIN; -import static org.onap.pnfsimulator.message.MessageConstants.EVENT_ID; -import static org.onap.pnfsimulator.message.MessageConstants.EVENT_TYPE; -import static org.onap.pnfsimulator.message.MessageConstants.INTERNAL_HEADER_FIELDS; -import static org.onap.pnfsimulator.message.MessageConstants.LAST_EPOCH_MICROSEC; -import static org.onap.pnfsimulator.message.MessageConstants.OTHER_FIELDS; -import static org.onap.pnfsimulator.message.MessageConstants.OTHER_FIELDS_VERSION; -import static org.onap.pnfsimulator.message.MessageConstants.PNF_LAST_SERVICE_DATE; -import static org.onap.pnfsimulator.message.MessageConstants.PNF_MANUFACTURE_DATE; -import static org.onap.pnfsimulator.message.MessageConstants.PRIORITY; -import static org.onap.pnfsimulator.message.MessageConstants.SEQUENCE; -import static org.onap.pnfsimulator.message.MessageConstants.START_EPOCH_MICROSEC; -import static org.onap.pnfsimulator.message.MessageConstants.VERSION; +import static org.onap.pnfsimulator.message.MessageConstants.*; import java.util.UUID; import org.json.JSONObject; @@ -45,9 +52,10 @@ public class MessageProviderTest { @Test public void createMessage_should_create_constant_message_when_no_params_specified() { JSONObject message = messageProvider.createMessage(new JSONObject()); + JSONObject event = message.getJSONObject(EVENT); - JSONObject commonEventHeader = message.getJSONObject(COMMON_EVENT_HEADER); - JSONObject otherFields = message.getJSONObject(OTHER_FIELDS); + JSONObject commonEventHeader = event.getJSONObject(COMMON_EVENT_HEADER); + JSONObject otherFields = event.getJSONObject(OTHER_FIELDS); JSONObject expectedCommonEventHeader = generateConstantCommonEventHeader(); JSONObject expectedOtherFields = generateConstantOtherFields(); @@ -69,8 +77,9 @@ public class MessageProviderTest { JSONObject params = new JSONObject(testParamsJson); JSONObject message = messageProvider.createMessage(params); - JSONObject commonEventHeader = message.getJSONObject(COMMON_EVENT_HEADER); - JSONObject otherFields = message.getJSONObject(OTHER_FIELDS); + JSONObject event = message.getJSONObject(EVENT); + JSONObject commonEventHeader = event.getJSONObject(COMMON_EVENT_HEADER); + JSONObject otherFields = event.getJSONObject(OTHER_FIELDS); assertEquals("pnfVal3", otherFields.getString("pnfKey3")); assertEquals("val1", commonEventHeader.getString("key1")); |