From c89f9145b44e5b9823b0a41f2c7968cfebf48a10 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Wed, 9 May 2018 11:42:48 +0000 Subject: Update cli utils test to std compliant Issue-ID: CLI-100 Change-Id: Iae82c8a28481c74d3fedb7c5c907a4d68a2ad898 Signed-off-by: Kanagaraj Manickam k00365106 --- .../org/onap/cli/main/utils/OnapCliUtilsTest.java | 49 +++++++++++++++------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'main/src/test/java/org') diff --git a/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java b/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java index c3627ca2..2c74cf05 100644 --- a/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java +++ b/main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java @@ -17,12 +17,9 @@ package org.onap.cli.main.utils; import java.io.File; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; -import java.util.Map; -import java.util.Optional; import java.util.Set; import org.junit.Assert; @@ -65,8 +62,13 @@ public class OnapCliUtilsTest { paramslist.add(param4); paramslist.add(param5); - String[] args = new String[] { "sample-create", "--host-username", "admin", "--host-password", "123", - "--host-url", "a@b.com", "--string-param", "blah", "--long-opt", "10" }; + String[] args = new String[] { + "sample-create", + "--host-username", "admin", + "--host-password", "123", + "--host-url", "a@b.com", + "--string-param", "blah", + "--long-opt", "10" }; OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args)); List expectedList = Arrays.asList(args); @@ -214,8 +216,13 @@ public class OnapCliUtilsTest { paramslist.add(param4); paramslist.add(param5); - String[] args11 = new String[] { "sample-create", "-u", "admin", "-p", "123", "-r", "a@b.com", "-c", "blah", - "-l", "10", }; + String[] args11 = new String[] { + "sample-create", + "-u", "admin", + "-p", "123", + "-r", "a@b.com", + "-c", "blah", + "-l", "10", }; OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args11)); List expectedList = Arrays.asList(args11); @@ -257,7 +264,8 @@ public class OnapCliUtilsTest { OnapCliArgsParser.populateParams(paramslist, Arrays.asList("show", "--map", "param1=value1", "--map", "param2=value2")); - Assert.assertEquals("{param1=value1, param2=value2}", paramslist.iterator().next().getValue().toString()); + Assert.assertEquals("{param1=value1, param2=value2}", + paramslist.iterator().next().getValue().toString()); } @Test(expected = OnapCliInvalidArgument.class) @@ -270,8 +278,10 @@ public class OnapCliUtilsTest { paramslist.add(param1); param1.setParameterType(OnapCommandParameterType.MAP); - OnapCliArgsParser.populateParams(paramslist, Arrays.asList("show", "--map", "param1=value1", "--map", "param2")); - Assert.assertEquals("{\"param1\":\"value1\",\"param2\"}", paramslist.iterator().next().getValue().toString()); + OnapCliArgsParser.populateParams(paramslist, + Arrays.asList("show", "--map", "param1=value1", "--map", "param2")); + Assert.assertEquals("{\"param1\":\"value1\",\"param2\"}", + paramslist.iterator().next().getValue().toString()); } @Test(expected = OnapCliInvalidArgument.class) @@ -283,8 +293,10 @@ public class OnapCliUtilsTest { Set paramslist = new HashSet<>(); paramslist.add(param1); param1.setParameterType(OnapCommandParameterType.MAP); - OnapCliArgsParser.populateParams(paramslist, Arrays.asList("show", "-o", "param1=value1", "-o", "param2")); - Assert.assertEquals("{\"param1\":\"value1\",\"param2\"}", paramslist.iterator().next().getValue().toString()); + OnapCliArgsParser.populateParams(paramslist, + Arrays.asList("show", "-o", "param1=value1", "-o", "param2")); + Assert.assertEquals("{\"param1\":\"value1\",\"param2\"}", + paramslist.iterator().next().getValue().toString()); } @Test(expected = OnapCliInvalidArgument.class) @@ -293,12 +305,15 @@ public class OnapCliUtilsTest { paramargs.setName("http://localhost:8082/file.txt"); Set paramslist = new HashSet<>(); paramslist.add(paramargs); - String[] args = new String[] { "positional-args", "http://localhost:8082/file.txt", - "http://localhost:8082/file.txt" }; + String[] args = new String[] { + "positional-args", + "http://localhost:8082/file.txt", + "http://localhost:8082/file.txt" }; paramargs.setParameterType(OnapCommandParameterType.STRING); OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args)); List expectedList = Arrays.asList(args); - Assert.assertEquals("positional-args", expectedList.get(1), paramslist.iterator().next().getValue()); + Assert.assertEquals("positional-args", + expectedList.get(1), paramslist.iterator().next().getValue()); } @Test(expected = OnapCliInvalidArgument.class) @@ -339,7 +354,9 @@ public class OnapCliUtilsTest { Set paramslist = new HashSet<>(); paramslist.add(jsonparam); File resourcesDirectory = new File("src/test/resources/sampletest.json"); - String[] args = new String[] { "sample-create", "--json-param", "file:" + resourcesDirectory, "--json-param" }; + String[] args = new String[] { + "sample-create", "--json-param", + "file:" + resourcesDirectory, "--json-param" }; jsonparam.setParameterType(OnapCommandParameterType.JSON); OnapCliArgsParser.populateParams(paramslist, Arrays.asList(args)); List expectedList = Arrays.asList(args); -- cgit 1.2.3-korg