diff options
author | Sudarshan Kumar <sudars19@in.ibm.com> | 2019-02-05 15:12:25 +0530 |
---|---|---|
committer | Joss Armstrong <joss.armstrong@ericsson.com> | 2019-02-05 15:26:07 +0000 |
commit | 957d0a86172d5568c45c6c2aa595a9b2cc8de7ee (patch) | |
tree | 6b452aeaab2ea16dd7644feba3a4069eab66e3f1 /appc-client | |
parent | 02eadec15d96ce2245cead47120d9170a7a4a51f (diff) |
Added Junit class for ProtocolException.java
Added Junit class for ProtocolException.java
Issue-ID: APPC-1372
Change-Id: I695c7dca1cf92c2aa9354c6738042b20f949a215
Signed-off-by: Sudarshan Kumar <sudars19@in.ibm.com>
Diffstat (limited to 'appc-client')
-rw-r--r-- | appc-client/client-lib/src/test/java/org/onap/appc/client/impl/protocol/TestProtocolException.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/appc-client/client-lib/src/test/java/org/onap/appc/client/impl/protocol/TestProtocolException.java b/appc-client/client-lib/src/test/java/org/onap/appc/client/impl/protocol/TestProtocolException.java new file mode 100644 index 000000000..aa399b12f --- /dev/null +++ b/appc-client/client-lib/src/test/java/org/onap/appc/client/impl/protocol/TestProtocolException.java @@ -0,0 +1,70 @@ +/* + * ============LICENSE_START========================================== + * org.onap.music + * =================================================================== + * Copyright (c) 2019 IBM. + * =================================================================== + * 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. + * + * ============LICENSE_END============================================= + * ==================================================================== + */ +package org.onap.appc.client.impl.protocol; + +import org.junit.Assert; +import org.junit.Test; + +public class TestProtocolException { + + @Test + public void TestProException() { + try { + throw new ProtocolException(); + } catch (ProtocolException protocolException) { + Assert.assertEquals("org.onap.appc.client.impl.protocol.ProtocolException", + protocolException.getClass().getName()); + } + } + + @Test + public void TestProtocolException1() { + try { + throw new ProtocolException("ProtocolException"); + } catch (ProtocolException protocolException) { + Assert.assertEquals("ProtocolException", protocolException.getMessage()); + } + } + + @Test + public void TestProtocolException2() { + try { + throw new ProtocolException("ProtocolException", new Throwable("Test Message")); + } catch (ProtocolException protocolException) { + Assert.assertEquals("ProtocolException", protocolException.getMessage()); + Assert.assertEquals("Test Message", protocolException.getCause().getMessage()); + } + + } + + @Test + public void TestProtocolException3() { + try { + throw new ProtocolException(new Throwable()); + } catch (ProtocolException protocolException) { + Assert.assertEquals("org.onap.appc.client.impl.protocol.ProtocolException", + protocolException.getClass().getName()); + } + + } + +} |