added test case to TestPatternNode.java 57/73657/2
authorSandeep J <sandeejh@in.ibm.com>
Tue, 27 Nov 2018 11:27:28 +0000 (16:57 +0530)
committerTakamune Cho <takamune.cho@att.com>
Wed, 28 Nov 2018 01:44:12 +0000 (01:44 +0000)
to increase code coverage

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

index c1f66f2..848632b 100644 (file)
@@ -6,7 +6,7 @@
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * =============================================================================
- * Modification Copyright (C) 2018 IBM.
+ * Modifications 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.
@@ -31,6 +31,7 @@ import java.util.Map;
 import org.apache.commons.io.IOUtils;
 import org.junit.Test;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.sdnc.config.generator.ConfigGeneratorConstant;
 
 public class TestPatternNode {
@@ -50,6 +51,20 @@ public class TestPatternNode {
                 ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
 
     }
+    
+    @Test(expected= SvcLogicException.class)
+    public void testParseErrorLogForEmptyLogData() throws Exception {
+        PatternNode patternNode = new PatternNode();
+        Map<String, String> inParams = new HashMap<String, String>();
+        inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+        String logData = IOUtils.toString(
+                TestPatternNode.class.getClassLoader().getResourceAsStream("pattern/errorlog.txt"),
+                ConfigGeneratorConstant.STRING_ENCODING);
+        SvcLogicContext ctx = new SvcLogicContext();
+        patternNode.parseErrorLog(inParams, ctx);
+       
+    }
+
 
     // @Test(expected=Exception.class)
     public void checkXMLData() throws Exception {