aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/test/java/org
diff options
context:
space:
mode:
authorKanagaraj Manickam <kanagaraj.manickam@huawei.com>2020-07-01 04:48:14 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-01 04:48:14 +0000
commit022ee4b8daa1b852d72c1083658d1efb254f9dd5 (patch)
tree3acfd05d04321b7684579b0259c2f9303f35868c /framework/src/test/java/org
parent29308f5f904e6bfd92204137357fe350d40cf083 (diff)
parent268be523fb1142138a3f710642b5773453841eeb (diff)
Merge "code improvements"
Diffstat (limited to 'framework/src/test/java/org')
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java23
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java14
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}");