diff options
author | priyanka.akhade <priyanka.akhade@huawei.com> | 2020-06-18 15:11:08 +0530 |
---|---|---|
committer | priyanka.akhade <priyanka.akhade@huawei.com> | 2020-07-01 09:51:04 +0530 |
commit | 268be523fb1142138a3f710642b5773453841eeb (patch) | |
tree | 2e88b62a1e3059a050335d2f19467e3d2d451a41 /framework/src/test/java/org | |
parent | a13ffa03bf353bc70cb20cc0481ba89e24fd2cdb (diff) |
code improvements
Signed-off-by: priyanka.akhade <priyanka.akhade@huawei.com>
Issue-ID: CLI-270
Change-Id: If9eab4bc8642c7c20a841d58c8a9e2bf5ae6c98b
Diffstat (limited to 'framework/src/test/java/org')
-rw-r--r-- | framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java | 23 | ||||
-rw-r--r-- | framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java | 14 |
2 files changed, 35 insertions, 2 deletions
diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java index 5d83374c..741b53a1 100644 --- a/framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java +++ b/framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java @@ -25,7 +25,10 @@ import org.onap.cli.fw.store.OnapCommandExecutionStoreTest; import java.io.File; import java.util.List; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; +import mockit.Mock; +import mockit.MockUp; +import org.onap.cli.fw.store.OnapCommandExecutionStore; public class OnapCommandExceutionShowCommandTest { @BeforeClass @@ -46,7 +49,23 @@ public static void setUp() throws Exception { assertTrue(oclipCommandResultAttributes.size() > 1); } - + @Test + public void runTestForStringBuilder() throws OnapCommandException { + new MockUp<OnapCommandExecutionStore.Execution>(){ + @Mock + public String getOutput() { + return "oclip-request-output"; + } + }; + OnapCommandExceutionShowCommand cmd=new OnapCommandExceutionShowCommand(); + cmd.initializeSchema("execution-show.yaml"); + cmd.getParametersMap().get("execution-id").setValue("requestId"); + cmd.getParametersMap().get("format").setValue("TEXT"); + cmd.execute(); + List<OnapCommandResultAttribute> oclipCommandResultAttributes = cmd.getResult() + .getRecords(); + assertTrue(oclipCommandResultAttributes.size() > 1); + } @AfterClass public static void tearDown() throws Exception { String dirPathForExecutions = System.getProperty("user.dir") + File.separator + "data/executions"; diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java index 9c31747b..e01c3878 100644 --- a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java +++ b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java @@ -132,6 +132,20 @@ public class OnapCommandUtilsTest { } @Test + public void replaceLineFromResultsTest() { + String replacedLine = OnapCommandUtils.replaceLineFromResults("line", new HashMap<>()); + assertEquals("line", replacedLine); + replacedLine = OnapCommandUtils.replaceLineFromResults("${}", new HashMap<>()); + assertEquals("${}", replacedLine); + replacedLine = OnapCommandUtils.replaceLineFromResults("$r{}", new HashMap<>()); + assertTrue( replacedLine.isEmpty()); + HashMap<String, String> values = new HashMap<>(); + values.put("This is test line","This is test line"); + replacedLine = OnapCommandUtils.replaceLineFromResults("$r{This is test line}", values); + assertEquals("This is test line", replacedLine); + } + + @Test public void replaceLineForSpecialValues_replacingUuid() { String replacedLine = OnapCommandUtils.replaceLineForSpecialValues("$s{uuid}"); |