diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
index 266603d..a7cc1bd 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
@@ -35,119 +35,152 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.gson.JsonObject;
+
 public class CheckParametersTest {
 
-	@Test
-	public void nullRequiredParameters() throws Exception {
-		Map<String, String> parametersMap = new HashMap<String, String>();
-		String[] requiredParams = null;
-		Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
-		SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
-	}
+    @Test
+    public void nullRequiredParameters() throws Exception {
+        Map<String, String> parametersMap = new HashMap<String, String>();
+        String[] requiredParams = null;
+        Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
+        SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
+    }
 
-	@Test(expected = SvcLogicException.class)
-	public void emptyParametersMap() throws Exception {
-		Map<String, String> parametersMap = new HashMap<String, String>();
-		String[] requiredParams = new String[] { "param1", "param2", "param3" };
-		Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
-		SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
-	}
+    @Test(expected = SvcLogicException.class)
+    public void emptyParametersMap() throws Exception {
+        Map<String, String> parametersMap = new HashMap<String, String>();
+        String[] requiredParams = new String[] { "param1", "param2", "param3" };
+        Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
+        SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
+    }
 
-	@Test(expected = SvcLogicException.class)
-	public void paramNotFound() throws Exception {
-		Map<String, String> parametersMap = new HashMap<String, String>();
-		parametersMap.put("tst", "me");
-		String[] requiredParams = new String[] { "param1", "parm2", "param3" };
-		Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
-		SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
-	}
+    @Test(expected = SvcLogicException.class)
+    public void paramNotFound() throws Exception {
+        Map<String, String> parametersMap = new HashMap<String, String>();
+        parametersMap.put("tst", "me");
+        String[] requiredParams = new String[] { "param1", "parm2", "param3" };
+        Logger Log = LoggerFactory.getLogger(SliPluginUtils.class);
+        SliPluginUtils.checkParameters(parametersMap, requiredParams, Log);
+    }
 
-	@Test
-	public void testSunnyRequiredParameters() throws Exception {
-		SvcLogicContext ctx = new SvcLogicContext();
-		ctx.setAttribute("param1", "hello");
-		ctx.setAttribute("param2", "world");
-		ctx.setAttribute("param3", "!");
+    @Test
+    public void testSunnyRequiredParameters() throws Exception {
+        SvcLogicContext ctx = new SvcLogicContext();
+        ctx.setAttribute("param1", "hello");
+        ctx.setAttribute("param2", "world");
+        ctx.setAttribute("param3", "!");
 
-		Map<String, String> parameters = new HashMap<String, String>();
-		parameters.put("param1", "dog");
-		parameters.put("param2", "cat");
-		parameters.put("param3", "fish");
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("param1", "dog");
+        parameters.put("param2", "cat");
+        parameters.put("param3", "fish");
 
-		SliPluginUtils.requiredParameters(parameters, ctx);
-	}
+        SliPluginUtils.requiredParameters(parameters, ctx);
+    }
 
-	@Test
-	public void testSunnyRequiredParametersWithPrefix() throws Exception {
-		String prefixValue = "my.unique.path.";
-		SvcLogicContext ctx = new SvcLogicContext();
-		ctx.setAttribute(prefixValue + "param1", "hello");
-		ctx.setAttribute(prefixValue + "param2", "world");
-		ctx.setAttribute(prefixValue + "param3", "!");
+    @Test
+    public void testSunnyRequiredParametersWithPrefix() throws Exception {
+        String prefixValue = "my.unique.path.";
+        SvcLogicContext ctx = new SvcLogicContext();
+        ctx.setAttribute(prefixValue + "param1", "hello");
+        ctx.setAttribute(prefixValue + "param2", "world");
+        ctx.setAttribute(prefixValue + "param3", "!");
 
-		Map<String, String> parameters = new HashMap<String, String>();
-		parameters.put("prefix", prefixValue);
-		parameters.put("param1", "dog");
-		parameters.put("param2", "cat");
-		parameters.put("param3", "fish");
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("prefix", prefixValue);
+        parameters.put("param1", "dog");
+        parameters.put("param2", "cat");
+        parameters.put("param3", "fish");
 
-		SliPluginUtils.requiredParameters(parameters, ctx);
-	}
+        SliPluginUtils.requiredParameters(parameters, ctx);
+    }
 
-	@Test(expected = SvcLogicException.class)
-	public void testRainyMissingRequiredParameters() throws Exception {
-		SvcLogicContext ctx = new SvcLogicContext();
-		ctx.setAttribute("param1", "hello");
-		ctx.setAttribute("param3", "!");
+    @Test(expected = SvcLogicException.class)
+    public void testRainyMissingRequiredParameters() throws Exception {
+        SvcLogicContext ctx = new SvcLogicContext();
+        ctx.setAttribute("param1", "hello");
+        ctx.setAttribute("param3", "!");
 
-		Map<String, String> parameters = new HashMap<String, String>();
-		parameters.put("param1", null);
-		parameters.put("param2", null);
-		parameters.put("param3", null);
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("param1", null);
+        parameters.put("param2", null);
+        parameters.put("param3", null);
 
-		SliPluginUtils.requiredParameters(parameters, ctx);
-	}
+        SliPluginUtils.requiredParameters(parameters, ctx);
+    }
 
-	@Test(expected = SvcLogicException.class)
-	public void testEmptyRequiredParameters() throws Exception {
-		SvcLogicContext ctx = new SvcLogicContext();
-		ctx.setAttribute("param1", "hello");
-		ctx.setAttribute("param3", "!");
+    @Test(expected = SvcLogicException.class)
+    public void testEmptyRequiredParameters() throws Exception {
+        SvcLogicContext ctx = new SvcLogicContext();
+        ctx.setAttribute("param1", "hello");
+        ctx.setAttribute("param3", "!");
 
-		Map<String, String> parameters = new HashMap<String, String>();
+        Map<String, String> parameters = new HashMap<String, String>();
 
-		SliPluginUtils.requiredParameters(parameters, ctx);
-	}
+        SliPluginUtils.requiredParameters(parameters, ctx);
+    }
 
-	@Test(expected = SvcLogicException.class)
-	public void testJsonStringToCtx() throws Exception {
-		SvcLogicContext ctx = new SvcLogicContext();
-		Map<String, String> parameters = new HashMap<String, String>();
-		parameters.put("outputPath", "testPath");
-		parameters.put("isEscaped", "true");
-		parameters.put("source", "//{/name1/:value1/}//");
-		SliPluginUtils.jsonStringToCtx(parameters, ctx);
-	}
+    @Test(expected = SvcLogicException.class)
+    public void testJsonStringToCtx() throws Exception {
+        SvcLogicContext ctx = new SvcLogicContext();
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("outputPath", "testPath");
+        parameters.put("isEscaped", "true");
+        parameters.put("source", "//{/name1/:value1/}//");
+        SliPluginUtils.jsonStringToCtx(parameters, ctx);
+    }
 
-	@Test
-	public void testGetAttributeValue() throws Exception {
-		SvcLogicContext ctx = new SvcLogicContext();
-		Map<String, String> parameters = new HashMap<String, String>();
-		parameters.put("outputPath", "testPath");
-		parameters.put("source", "testSource");
-		SliPluginUtils.getAttributeValue(parameters, ctx);
-		assertNull(ctx.getAttribute(parameters.get("outputPath")));
-	}
+    @Test
+    public void testGetAttributeValue() throws Exception {
+        SvcLogicContext ctx = new SvcLogicContext();
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("outputPath", "testPath");
+        parameters.put("source", "testSource");
+        SliPluginUtils.getAttributeValue(parameters, ctx);
+        assertNull(ctx.getAttribute(parameters.get("outputPath")));
+    }
 
-	@Test
-	public void testCtxListContains() throws Exception {
-		SvcLogicContext ctx = new SvcLogicContext();
-		Map<String, String> parameters = new HashMap<String, String>();
-		parameters.put("list", "10_length");
-		parameters.put("keyName", "testName");
-		parameters.put("keyValue", "testValue");
-		ctx.setAttribute("10_length", "10");
-		assertEquals("false", SliPluginUtils.ctxListContains(parameters, ctx));
+    @Test
+    public void testCtxListContains() throws Exception {
+        SvcLogicContext ctx = new SvcLogicContext();
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("list", "10_length");
+        parameters.put("keyName", "testName");
+        parameters.put("keyValue", "testValue");
+        ctx.setAttribute("10_length", "10");
+        assertEquals("false", SliPluginUtils.ctxListContains(parameters, ctx));
 
-	}
+    }
+    
+    @Test(expected= SvcLogicException.class)
+    public void testPrintContextForNullParameters() throws SvcLogicException
+    {
+        SvcLogicContext ctx = new SvcLogicContext();
+        Map<String, String> parameters = new HashMap<String, String>();
+        SliPluginUtils.printContext(parameters, ctx);
+    }
+    
+    @Test
+    public void testPrintContext() throws SvcLogicException
+    {
+        SvcLogicContext ctx = new SvcLogicContext();
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put("filename","testFileName");
+        SliPluginUtils.printContext(parameters, ctx);
+    }
+    
+    @Test
+    public void testWriteJsonObject() throws SvcLogicException
+    {
+        JsonObject obj=new JsonObject();
+        obj.addProperty("name","testName");
+        obj.addProperty("age",27);
+        obj.addProperty("salary",600000);
+        SvcLogicContext ctx = new SvcLogicContext();
+        SliPluginUtils.writeJsonObject(obj, ctx,"root");
+        assertEquals("testName", ctx.getAttribute("root.name"));
+        assertEquals("27", ctx.getAttribute("root.age"));
+        assertEquals("600000", ctx.getAttribute("root.salary"));
+    }
 }
