diff options
Diffstat (limited to 'reception/src/test/java')
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); |