diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2018-09-10 01:59:39 +0530 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-09-11 15:02:46 +0000 |
commit | 5db773715b158ab9194051e7a60c366f1114bc19 (patch) | |
tree | b1fa4c17ddc5c9f317b0be1c8030982c861f7568 /appc-config/appc-config-audit/provider/src | |
parent | 91a12713611ef604a5e301315ad0896e829cd6c0 (diff) |
refactored code for TestCompareNodeCli
added object creation to setup method using before annotation
Issue-ID: APPC-1086
Change-Id: Ia125c53807d4f255686d4f2ff6af818c1b08ca4d
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-config/appc-config-audit/provider/src')
-rw-r--r-- | appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeCli.java | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeCli.java b/appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeCli.java index bd28ef7a3..1e8c4f8b2 100644 --- a/appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeCli.java +++ b/appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeCli.java @@ -27,6 +27,7 @@ package org.onap.sdnc.config.audit.node; import java.util.HashMap; +import org.junit.Before; import org.junit.Test; import org.onap.sdnc.config.audit.node.CompareNode; import org.slf4j.Logger; @@ -38,12 +39,21 @@ import static org.junit.Assert.assertEquals; public class TestCompareNodeCli { private static final Logger log = LoggerFactory.getLogger(TestCompareNodeCli.class); - + private CompareNode cmp; + SvcLogicContext ctx; + HashMap<String, String> testMap; + + + @Before + public void setUp() + { + cmp = new CompareNode(); + ctx = new SvcLogicContext(); + testMap = new HashMap<String, String>(); + } + @Test public void TestCompareCliForSamePayload() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - HashMap<String, String> testMap = new HashMap<String, String>(); - CompareNode cmp = new CompareNode(); testMap.put("compareDataType", "Cli"); testMap.put("sourceData", "This is a Text Configuration of Device"); testMap.put("targetData", "This is a Text Configuration of Device"); @@ -53,9 +63,6 @@ public class TestCompareNodeCli { @Test public void TestCompareCliForNoPayload() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - HashMap<String, String> testMap = new HashMap<String, String>(); - CompareNode cmp = new CompareNode(); testMap.put("compareDataType", "Cli"); cmp.compare(testMap, ctx); assertEquals ("FAILURE",ctx.getAttribute("STATUS")); @@ -63,9 +70,6 @@ public class TestCompareNodeCli { @Test public void TestCompareCliFordifferentPayload() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - HashMap<String, String> testMap = new HashMap<String, String>(); - CompareNode cmp = new CompareNode(); testMap.put("compareDataType", "Cli"); testMap.put("sourceData", "This is a Text Negative test Configuration of Device"); testMap.put("targetData", "This is a Text Configuration of Device"); @@ -75,9 +79,6 @@ public class TestCompareNodeCli { @Test public void TestCompareForMissingInput() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - HashMap<String, String> testMap = new HashMap<String, String>(); - CompareNode cmp = new CompareNode(); testMap.put("sourceData", "This is a Text Negative test Configuration of Device"); testMap.put("targetData.configuration-data", "This is a Text Configuration of Device"); cmp.compare(testMap, ctx); |