diff options
author | uj426b <uj426b@att.com> | 2020-07-23 16:17:24 -0400 |
---|---|---|
committer | uj426b <uj426b@att.com> | 2020-07-29 07:14:36 -0400 |
commit | 150c53fdda47ae838a8783b8bdfd3168bd0484e0 (patch) | |
tree | e17fd77305c5afce93154ea128b75fda11eda110 /main/src | |
parent | 3e19dab2db3230de597030a28969b5b41135ec92 (diff) |
Sonar fixes for policy/distribution
Change-Id: Ia48406096706daaa6a98985c488b4055276863d3
Issue-ID: POLICY-2713
Signed-off-by: uj426b <uj426b@att.com>
Diffstat (limited to 'main/src')
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()); } } |