From d8b7a6a745bf861c896360950a6e4d41742cb9b4 Mon Sep 17 00:00:00 2001 From: surya-huawei Date: Tue, 26 Sep 2017 13:01:50 +0530 Subject: Add unit test for SliStringUtils *Made quotedOrNull method public This is done for accessing this in ut *Added a unit test for the SliStringUtils.quotedOrNull() This is done for increasing code coverage Issue-Id: CCSDK-106 Change-Id: I9d74c6645256227b23beded5179fbb28ac3d3c04 Signed-off-by: surya-huawei --- .../java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java | 2 +- .../org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'sliPluginUtils/provider/src') diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java index 6048c66d6..0c43f6850 100644 --- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java +++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtils.java @@ -100,7 +100,7 @@ public class SliStringUtils implements SvcLogicJavaPlugin { } } - private static String quotedOrNULL( String str ) { + public static String quotedOrNULL( String str ) { return (str == null) ? "NULL" : '"' + str + '"'; } diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java index 72b3264e9..96c6ae4ac 100644 --- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java +++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java @@ -90,6 +90,12 @@ public class SliStringUtilsTest { assertThat(ctx.getAttribute("result_length"), equalTo("2")); } + @Test + public final void testQuotedOrNull() throws SvcLogicException { + //param.put("nullString",null); + assertEquals("NULL",SliStringUtils.quotedOrNULL(null)); + } + @Test public void equalsIgnoreCaseTrue() throws SvcLogicException { String sourceString = "HeLlOwORLD"; -- cgit 1.2.3-korg