aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-05-09 11:42:48 +0000
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-05-09 11:42:48 +0000
commitc89f9145b44e5b9823b0a41f2c7968cfebf48a10 (patch)
tree078a15ebe316aee1e262843e543548c0b403d7b2
parentc5e79e7b49f0566ffb5a532be022a69e2a74bdb3 (diff)
Update cli utils test to std compliant
Issue-ID: CLI-100 Change-Id: Iae82c8a28481c74d3fedb7c5c907a4d68a2ad898 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
-rw-r--r--main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java49
1 files changed, 33 insertions, 16 deletions
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<String> 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<String> 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<OnapCommandParameter> 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<OnapCommandParameter> 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<String> 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<OnapCommandParameter> 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<String> expectedList = Arrays.asList(args);