aboutsummaryrefslogtreecommitdiffstats
path: root/reception/src/test
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@ericsson.com>2018-08-23 13:50:31 +0100
committerramverma <ram.krishna.verma@ericsson.com>2018-08-24 10:04:31 +0100
commitef2ff6bae65870a4fccc25373c0cfae881e14a81 (patch)
tree2329de6759a3f74237b8a64dcbe63d7114f532ef /reception/src/test
parent55e6bdc93d05f1c9673a4ecbe133207722216eb0 (diff)
Fix sonar and checkstyle issues in distribution
* Fixing all check style issues. * Fixing all sonar issues. * Adding maven check style plugin to fail at warning level. Change-Id: I791b8feef39a3a0c3e1e250efea7b6e78208bf07 Issue-ID: POLICY-1035 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'reception/src/test')
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/decoding/PolicyInitializationExceptionTest.java50
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java10
2 files changed, 55 insertions, 5 deletions
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/decoding/PolicyInitializationExceptionTest.java b/reception/src/test/java/org/onap/policy/distribution/reception/decoding/PolicyInitializationExceptionTest.java
new file mode 100644
index 00000000..bf327554
--- /dev/null
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/decoding/PolicyInitializationExceptionTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.decoding;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+/**
+ * Class to perform unit test of PluginInitializationException.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class PolicyInitializationExceptionTest {
+
+ @Test
+ public void testPolicyInitializationExceptionString() {
+ final PluginInitializationException policyInitializationException =
+ new PluginInitializationException("error message");
+ assertEquals("error message", policyInitializationException.getMessage());
+ }
+
+ @Test
+ public void testPolicyInitializationExceptionStringThrowable() {
+ final Exception cause = new IllegalArgumentException();
+ final PluginInitializationException policyInitializationException =
+ new PluginInitializationException("error message", cause);
+ assertEquals("error message", policyInitializationException.getMessage());
+ assertEquals(cause, policyInitializationException.getCause());
+ }
+
+}
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java b/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java
index bb9b542a..83fe5a45 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java
@@ -33,10 +33,10 @@ import java.util.Map;
import org.junit.Test;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.PolicyForwarder;
-import org.onap.policy.distribution.forwarding.PolicyForwardingException;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
import org.onap.policy.distribution.model.Policy;
import org.onap.policy.distribution.model.PolicyInput;
+import org.onap.policy.distribution.reception.decoding.PluginInitializationException;
import org.onap.policy.distribution.reception.decoding.PolicyDecoder;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
@@ -60,7 +60,7 @@ public class AbstractReceptionHandlerTest {
@Test
public void testInputReceived() throws PolicyDecodingException, NoSuchFieldException, SecurityException,
- IllegalArgumentException, IllegalAccessException, PolicyForwardingException {
+ IllegalArgumentException, IllegalAccessException, PluginInitializationException {
final AbstractReceptionHandler handler = new DummyReceptionHandler();
final Policy generatedPolicy1 = new DummyPolicy1();
@@ -96,7 +96,7 @@ public class AbstractReceptionHandlerTest {
@Test(expected = PolicyDecodingException.class)
public void testInputReceivedNoSupportingDecoder() throws PolicyDecodingException, NoSuchFieldException,
- SecurityException, IllegalArgumentException, IllegalAccessException, PolicyForwardingException {
+ SecurityException, IllegalArgumentException, IllegalAccessException, PluginInitializationException {
final AbstractReceptionHandler handler = new DummyReceptionHandler();
final PolicyDecoder<PolicyInput, Policy> policyDecoder = new DummyDecoder(false, Collections.emptyList());
@@ -108,7 +108,7 @@ public class AbstractReceptionHandlerTest {
@Test(expected = PolicyDecodingException.class)
public void testInputReceivedNoDecoder() throws PolicyDecodingException, NoSuchFieldException, SecurityException,
- IllegalArgumentException, IllegalAccessException, PolicyForwardingException {
+ IllegalArgumentException, IllegalAccessException, PluginInitializationException {
final AbstractReceptionHandler handler = new DummyReceptionHandler();
final DummyPolicyForwarder policyForwarder = new DummyPolicyForwarder();
@@ -129,7 +129,7 @@ public class AbstractReceptionHandlerTest {
private void setUpPlugins(final AbstractReceptionHandler receptionHandler,
final Collection<PolicyDecoder<PolicyInput, Policy>> decoders, final Collection<PolicyForwarder> forwarders)
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException,
- PolicyDecodingException, PolicyForwardingException {
+ PluginInitializationException {
final PluginHandlerParameters pluginParameters = getPluginHandlerParameters();
pluginParameters.setName(DISTRIBUTION_GROUP);
ParameterService.register(pluginParameters);