aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-policy/src/test/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2021-06-16 12:08:01 +0100
committerliamfallon <liam.fallon@est.tech>2021-06-17 15:51:34 +0100
commit2d186df9e3ed47599dbc86c2f435f7884535398c (patch)
treed77b85e48927ad072248e784c7b99b12205f4e0b /participant/participant-impl/participant-impl-policy/src/test/java
parent17f5d3c97e47064407452122bc6cb801e43df5f9 (diff)
Clean up CLAMP Sonar and checkstyle issues
This commit cleans up sonar and checkstyle issues identified in the CLAMP repository. Issue-ID: POLICY-3206 Change-Id: I16b61bbe771cc17de15183a24b2a5e82a8d35872 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-policy/src/test/java')
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
index e3d7e3aa5..1acc2c838 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.parameters.ParameterGroup;
@@ -51,15 +52,18 @@ public class CommonTestData {
/**
* Converts the contents of a map to a parameter class.
*
+ * @param <T> the type of ParameterGroup to process
* @param source property map
* @param clazz class of object to be created from the map
* @return a new object represented by the map
+ * @throws ControlLoopRuntimeException on decoding errors
*/
public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) {
try {
return coder.convert(source, clazz);
} catch (final CoderException e) {
- throw new RuntimeException("cannot create " + clazz.getName() + " from map", e);
+ throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE,
+ "cannot create " + clazz.getName() + " from map", e);
}
}
@@ -163,14 +167,15 @@ public class CommonTestData {
*
* @param port port to be inserted into the parameters
* @return the standard participant parameters
+ * @throws ControlLoopRuntimeException on parameter read errors
*/
public ParticipantPolicyParameters getParticipantPolicyParameters(int port) {
try {
return coder.decode(getParticipantPolicyParametersAsString(port), ParticipantPolicyParameters.class);
} catch (CoderException e) {
- throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
- "cannot read participant parameters", e);
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
+ e);
}
}
@@ -179,6 +184,7 @@ public class CommonTestData {
*
* @param port port to be inserted into the parameters
* @return the standard participant parameters
+ * @throws ControlLoopRuntimeException on parameter read errors
*/
public static String getParticipantPolicyParametersAsString(int port) {
@@ -192,8 +198,8 @@ public class CommonTestData {
return json;
} catch (IOException e) {
- throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
- "cannot read participant parameters", e);
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
+ e);
}
}
@@ -211,6 +217,7 @@ public class CommonTestData {
/**
* Nulls out a field within a JSON string.
+ *
* @param json JSON string
* @param field field to be nulled out
* @return a new JSON string with the field nulled out