From d22fdf6f05152000dcdcb805306781da4f87e553 Mon Sep 17 00:00:00 2001 From: amshegokar Date: Thu, 29 Mar 2018 13:27:29 +0530 Subject: 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 --- .../messageadapter/DmaapOutgoingMessageTest.java | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 appc-oam/appc-oam-bundle/src/test/java/org/onap/appc/oam/messageadapter/DmaapOutgoingMessageTest.java (limited to 'appc-oam/appc-oam-bundle') 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")); + } +} -- cgit 1.2.3-korg