aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-07-29 18:34:45 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-29 18:34:45 +0000
commit8d1d08871164b7252d64c5bebf4df44aab85c5a6 (patch)
tree40b9a97697b9b1ca8c07408125d478b8e4b61674
parent4d41572d68adf172ed5a35697ca506ce10f438a8 (diff)
parent150c53fdda47ae838a8783b8bdfd3168bd0484e0 (diff)
Merge "Sonar fixes for policy/distribution"
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java22
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java7
2 files changed, 13 insertions, 16 deletions
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
index a789569b..89d7c656 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -105,11 +106,9 @@ public class TestDistributionParameterHandler {
{ "-c", "parameters/NoParameters.json" };
final DistributionCommandLineArguments noArguments = new DistributionCommandLineArguments();
+ final DistributionParameterHandler paramHandler = new DistributionParameterHandler();
noArguments.parse(noArgumentString);
-
- assertThatThrownBy(() ->
- new DistributionParameterHandler().getParameters(noArguments)
- ).isInstanceOf(ParameterRuntimeException.class)
+ assertThatThrownBy(() -> paramHandler.getParameters(noArguments)).isInstanceOf(ParameterRuntimeException.class)
.hasMessageContaining("map parameter \"receptionHandlerParameters\" is null");
}
@@ -209,11 +208,10 @@ public class TestDistributionParameterHandler {
{ "-c", "parameters/DistributionConfigParameters_NoReceptionHandler.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ final DistributionParameterHandler paramHandler = new DistributionParameterHandler();
arguments.parse(distributionConfigParameters);
- assertThatThrownBy(() ->
- new DistributionParameterHandler().getParameters(arguments)
- ).isInstanceOf(ParameterRuntimeException.class)
+ assertThatThrownBy(() -> paramHandler.getParameters(arguments)).isInstanceOf(ParameterRuntimeException.class)
.hasMessageContaining("map parameter \"receptionHandlerParameters\" is null");
}
@@ -237,11 +235,10 @@ public class TestDistributionParameterHandler {
{ "-c", "parameters/DistributionConfigParameters_NoPolicyDecoder.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ final DistributionParameterHandler paramHandler = new DistributionParameterHandler();
arguments.parse(distributionConfigParameters);
- assertThatThrownBy(() ->
- new DistributionParameterHandler().getParameters(arguments)
- ).isInstanceOf(ParameterRuntimeException.class)
+ assertThatThrownBy(() -> paramHandler.getParameters(arguments)).isInstanceOf(ParameterRuntimeException.class)
.hasMessageContaining("map parameter \"policyDecoders\" is null");
}
@@ -251,11 +248,10 @@ public class TestDistributionParameterHandler {
{ "-c", "parameters/DistributionConfigParameters_NoPolicyForwarder.json" };
final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
+ final DistributionParameterHandler paramHandler = new DistributionParameterHandler();
arguments.parse(distributionConfigParameters);
- assertThatThrownBy(() ->
- new DistributionParameterHandler().getParameters(arguments)
- ).isInstanceOf(ParameterRuntimeException.class)
+ assertThatThrownBy(() -> paramHandler.getParameters(arguments)).isInstanceOf(ParameterRuntimeException.class)
.hasMessageContaining("map parameter \"policyForwarders\" is null");
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java
index e5d03aaf..f6ddbe99 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/startstop/TestMain.java
@@ -23,6 +23,7 @@ package org.onap.policy.distribution.main.startstop;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -51,7 +52,7 @@ public class TestMain {
final String[] distributionConfigParameters =
{};
final Main main = new Main(distributionConfigParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
@Test
@@ -59,7 +60,7 @@ public class TestMain {
final String[] distributionConfigParameters =
{ "parameters/DistributionConfigParameters.json" };
final Main main = new Main(distributionConfigParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
@Test
@@ -76,6 +77,6 @@ public class TestMain {
final String[] distributionConfigParameters =
{ "-c", "parameters/DistributionConfigParameters_InvalidName.json" };
final Main main = new Main(distributionConfigParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
}