summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramshegokar <AS00500801@techmahindra.com>2018-03-29 13:27:29 +0530
committerRanda Maher <rx196w@att.com>2018-03-29 16:57:42 +0000
commitd22fdf6f05152000dcdcb805306781da4f87e553 (patch)
treed3c39ba72b4252bce234fba38300cc2bc27c066e
parentace29f38ea5033db1ed347c8068f897530863b0d (diff)
Coverage for DmaapOutgoingMessage.java
Coverage for DmaapOutgoingMessage.java Sonar-Link: https://sonar.onap.org/code?id=org.onap.appc%3Aappc&selected=org.onap.appc%3Aappc-oam-bundle%3Asrc%2Fmain%2Fjava%2Forg%2Fonap%2Fappc%2Foam%2Fmessageadapter%2FDmaapOutgoingMessage.java Change-Id: Id7a7d8d76ad4bfce2e79ab9b62f39113dc4a8acb Issue-ID: APPC-797 Signed-off-by: amshegokar <AS00500801@techmahindra.com>
-rw-r--r--appc-oam/appc-oam-bundle/src/test/java/org/onap/appc/oam/messageadapter/DmaapOutgoingMessageTest.java88
1 files changed, 88 insertions, 0 deletions
diff --git a/appc-oam/appc-oam-bundle/src/test/java/org/onap/appc/oam/messageadapter/DmaapOutgoingMessageTest.java b/appc-oam/appc-oam-bundle/src/test/java/org/onap/appc/oam/messageadapter/DmaapOutgoingMessageTest.java
new file mode 100644
index 000000000..eb015e8b6
--- /dev/null
+++ b/appc-oam/appc-oam-bundle/src/test/java/org/onap/appc/oam/messageadapter/DmaapOutgoingMessageTest.java
@@ -0,0 +1,88 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : APPC
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.appc.oam.messageadapter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.appc.oam.messageadapter.DmaapOutgoingMessage.Body;
+
+public class DmaapOutgoingMessageTest {
+ private DmaapOutgoingMessage dmaapOutgoingMessage = new DmaapOutgoingMessage();
+ private Body body = new Body();
+
+ @Test
+ public void testGetServiceInstanceId() {
+ dmaapOutgoingMessage.setType("String");
+ Assert.assertEquals("String", dmaapOutgoingMessage.getType());
+ }
+
+ @Test
+ public void testGetCorrelationId() {
+ dmaapOutgoingMessage.setCorrelationID("ABC");
+ Assert.assertEquals("ABC", dmaapOutgoingMessage.getCorrelationID());
+ }
+
+ @Test
+ public void testGetCambriaPartition() {
+ dmaapOutgoingMessage.setCambriaPartition("cambriaPartition");
+ Assert.assertEquals("cambriaPartition", dmaapOutgoingMessage.getCambriaPartition());
+ }
+
+ @Test
+ public void testGetRpcName() {
+ dmaapOutgoingMessage.setRpcName("rpcName");
+ Assert.assertEquals("rpcName", dmaapOutgoingMessage.getRpcName());
+ }
+
+ @Test
+ public void testToString_ReturnNonEmptyString() {
+ Assert.assertNotEquals(dmaapOutgoingMessage.toString(), "");
+ Assert.assertNotEquals(dmaapOutgoingMessage.toString(), null);
+ }
+
+ @Test
+ public void testToString_ContainsString() {
+ Assert.assertTrue(dmaapOutgoingMessage.toString().contains("cambriaPartition"));
+ }
+
+ @Test
+ public void testGetBody() {
+ dmaapOutgoingMessage.setBody(new Body("This is test"));
+ Assert.assertEquals("This is test", dmaapOutgoingMessage.getBody().getOutput());
+ }
+
+ @Test
+ public void testGetOutput() {
+ dmaapOutgoingMessage.setBody(new Body());
+ dmaapOutgoingMessage.getBody().setOutput("Test Object");
+ Assert.assertEquals("Test Object", dmaapOutgoingMessage.getBody().getOutput());
+ }
+
+ @Test
+ public void testToStringBody_ReturnNonEmptyString() {
+ Assert.assertNotEquals(body.toString(), "");
+ Assert.assertNotEquals(body.toString(), null);
+ }
+
+ @Test
+ public void testToStringBody_ContainsString() {
+ Assert.assertTrue(body.toString().contains("Body"));
+ }
+}