diff options
author | 2020-12-16 04:25:37 +0000 | |
---|---|---|
committer | 2020-12-16 04:25:37 +0000 | |
commit | 1ade33bf7ca87020a6bc7a734d8d86961e332536 (patch) | |
tree | f7cee8f2036812a63fddbfd929ea5cc6de24c03c /framework/src/test | |
parent | 58f72b930243fe2346551476ddc37fd6531df09c (diff) | |
parent | 3bd15af9248f3347ab43324ab2ccee9dbb945db3 (diff) |
Merge "printyaml method fix"
Diffstat (limited to 'framework/src/test')
-rw-r--r-- | framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java index f46fc911..cf274f23 100644 --- a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java +++ b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java @@ -235,4 +235,39 @@ public class OnapCommandResultTest { assertEquals(expRes,result); } + + @Test + public void printYamlTest() throws OnapCommandException { + OnapCommandResult res = new OnapCommandResult(); + res.setDebugInfo("debugInfo"); + res.setIncludeSeparator(true); + res.setIncludeTitle(true); + res.setOutput("Output"); + res.setPrintDirection(OnapCommandPrintDirection.LANDSCAPE); + + OnapCommandResultAttribute att = new OnapCommandResultAttribute(); + att.setName("param"); + att.setDescription("description"); + att.setType(OnapCommandParameterType.YAML); + att.setValues( + new ArrayList<String>(Arrays.asList(new String[] { "{\"id\": \"0001\",\"value\": \"result\"}" }))); + List<OnapCommandResultAttribute> list = new ArrayList<OnapCommandResultAttribute>(); + list.add(att); + res.setRecords(list); + res.setScope(OnapCommandResultAttributeScope.LONG); + res.setType(OnapCommandResultType.YAML); + String result = res.print(); + String expRes="---\n- param:\n id: \"0001\"\n value: \"result\"\n"; + assertEquals(expRes,result); + + att.setValues( + new ArrayList<String>(Arrays.asList(new String[] { "{\"id\": \"0001\": \"value\": }" }))); + list = new ArrayList<OnapCommandResultAttribute>(); + list.add(att); + res.setRecords(list); + result = res.print(); + expRes="---\n- param: null\n"; + assertEquals(expRes,result); + + } } |