Fix sonar issues in policy-api 30/99030/2
authorJim Hahn <jrh3@att.com>
Mon, 2 Dec 2019 18:02:11 +0000 (13:02 -0500)
committerJim Hahn <jrh3@att.com>
Mon, 2 Dec 2019 18:22:46 +0000 (13:22 -0500)
The change to sonar cloud resulted in new issues being uncovered.
Addressed two of the three issues with this:
  Remove this unused import...
  Add at least one assertion to this test case.
The item left outstanding is:
  Make sure that command line arguments are used safely here.

Issue-ID: POLICY-2206
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: Ie5dc339640102a5b4471e5b719338358ec3e0209
Signed-off-by: Jim Hahn <jrh3@att.com>
main/src/main/java/org/onap/policy/api/main/parameters/ApiParameterGroup.java
main/src/test/java/org/onap/policy/api/main/startstop/TestMain.java

index 17f3f1a..aa8ad97 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.policy.api.main.parameters;
 
-import java.util.ArrayList;
 import java.util.List;
 import org.onap.policy.common.endpoints.parameters.RestServerParameters;
 import org.onap.policy.common.parameters.GroupValidationResult;
index d770b56..b97b0cc 100644 (file)
@@ -21,6 +21,7 @@
 
 package org.onap.policy.api.main.startstop;
 
+import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -63,7 +64,7 @@ public class TestMain {
     @Test
     public void testMain_Help() {
         final String[] apiConfigParameters = { "-h" };
-        Main.main(apiConfigParameters);
+        assertThatCode(() -> Main.main(apiConfigParameters)).doesNotThrowAnyException();
     }
 
     @Test