diff options
author | Sudarshan Kumar <sudars19@in.ibm.com> | 2019-02-04 22:48:30 +0530 |
---|---|---|
committer | Patrick Brady <patrick.brady@att.com> | 2019-02-05 18:55:27 +0000 |
commit | 6d90b168b366e90a0b13d1589830b2c3c83164bd (patch) | |
tree | 21c0c02c0e9f2b4c708a5828afd4a6bbc0a1638c /appc-dispatcher/appc-dispatcher-common/domain-model-lib | |
parent | beac33deccb8b7f98e7f96a17541abb81b246d16 (diff) |
Additional test case added ResponseContext.java
Additional junit test case added for ResponseContext.java
Issue-ID: APPC-1372
Change-Id: Iaa9455d80e84c46c39ffce066abe3aedfb56a58d
Signed-off-by: Sudarshan Kumar <sudars19@in.ibm.com>
Diffstat (limited to 'appc-dispatcher/appc-dispatcher-common/domain-model-lib')
-rw-r--r-- | appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/test/java/org/onap/appc/domainmodel/lcm/TestResponseContext.java | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/test/java/org/onap/appc/domainmodel/lcm/TestResponseContext.java b/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/test/java/org/onap/appc/domainmodel/lcm/TestResponseContext.java index ffa80b490..1b6fa4b05 100644 --- a/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/test/java/org/onap/appc/domainmodel/lcm/TestResponseContext.java +++ b/appc-dispatcher/appc-dispatcher-common/domain-model-lib/src/test/java/org/onap/appc/domainmodel/lcm/TestResponseContext.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright 2018 TechMahindra *================================================================================= -* Modifications Copyright 2018 IBM. +* Modifications Copyright 2019 IBM. *================================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,6 @@ */ package org.onap.appc.domainmodel.lcm; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertTrue; - import java.util.HashMap; import java.util.Map; @@ -34,15 +31,21 @@ import org.junit.Test; public class TestResponseContext { private ResponseContext responseContext; private Map<String, String> testadditionalContext; + private CommonHeader commonHeader; + private Status status; @Before public void setUp() { responseContext = new ResponseContext(); + commonHeader = new CommonHeader(); + commonHeader.setOriginatorId("originatorId"); + status = new Status(); + status.setCode(0); } @Test - public void testgetAdditionalContext() { - testadditionalContext=new HashMap<String, String>(); + public void testgetAdditionalContext() { + testadditionalContext = new HashMap<String, String>(); testadditionalContext.put("A", "a"); responseContext.setAdditionalContext(testadditionalContext); Assert.assertNotNull(responseContext.getAdditionalContext()); @@ -54,33 +57,45 @@ public class TestResponseContext { public void testGetPayload() { responseContext.setPayload("ABC:2000"); Assert.assertNotNull(responseContext.getPayload()); - Assert.assertEquals(responseContext.getPayload(), "ABC:2000"); + Assert.assertEquals("ABC:2000",responseContext.getPayload()); } @Test public void testToString_ReturnNonEmptyString() { - assertNotEquals(responseContext.toString(), ""); - assertNotEquals(responseContext.toString(), null); + Assert.assertNotEquals("",responseContext.toString()); + Assert.assertNotEquals(null,responseContext.toString()); } @Test public void testToString_ContainsString() { - assertTrue(responseContext.toString().contains("ResponseContext{commonHeader")); + Assert.assertTrue(responseContext.toString().contains("ResponseContext{commonHeader")); } - + @Test public void testAddKeyValueToAdditionalContext() { - String key="key1"; - String value="value1"; + String key = "key1"; + String value = "value1"; responseContext.addKeyValueToAdditionalContext(key, value); - Map<String, String> additionalContext= responseContext.getAdditionalContext(); + Map<String, String> additionalContext = responseContext.getAdditionalContext(); Assert.assertEquals("value1", additionalContext.get("key1")); } - + @Test public void testGetPayloadObject() { responseContext.setPayloadObject("ABC:2000"); Assert.assertEquals("ABC:2000", responseContext.getPayloadObject()); } + @Test + public void testGetCommonHeader() { + responseContext.setCommonHeader(commonHeader); + Assert.assertEquals("originatorId", responseContext.getCommonHeader().getOriginatorId()); + } + + @Test + public void testGetStatus() { + responseContext.setStatus(status); + Assert.assertEquals(0, responseContext.getStatus().getCode()); + } + } |