added test case to TestConvertNode.java 57/59657/4
authorSandeep J <sandeejh@in.ibm.com>
Wed, 8 Aug 2018 11:52:02 +0000 (17:22 +0530)
committerTakamune Cho <tc012c@att.com>
Thu, 9 Aug 2018 15:20:39 +0000 (15:20 +0000)
to increase code coverage

Issue-ID: APPC-1086
Change-Id: If2320397a735dd4f510350802df631cb132145e8
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
appc-config/appc-config-generator/provider/src/test/java/org/onap/sdnc/config/generator/convert/TestConvertNode.java

index 979a001..b084ba3 100644 (file)
@@ -6,6 +6,8 @@
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * =============================================================================
+ * Modification Copyright (C) 2018 IBM.
+ * =============================================================================
  * 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
@@ -23,7 +25,7 @@
 
 package org.onap.sdnc.config.generator.convert;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertEquals; 
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -159,4 +161,18 @@ public class TestConvertNode {
         convertNode.unEscapeData(inParams, ctx);
 
     }
+    
+    @Test
+    public void testEscapeDataForValidUnescapeDataString() throws Exception {
+        SvcLogicContext ctx = new SvcLogicContext();
+        Map<String, String> inParams = new HashMap<String, String>();
+        String unescapeData = "testUnescapeData";
+        inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+        inParams.put(ConfigGeneratorConstant.INPUT_PARAM_UNESCAPE_DATA, unescapeData);
+        inParams.put(ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE,
+                ConfigGeneratorConstant.DATA_TYPE_SQL);
+        ConvertNode convertNode = new ConvertNode();
+        convertNode.escapeData(inParams, ctx);
+        assertEquals(unescapeData, ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_ESCAPE_DATA));
+    }
 }