1 /*******************************************************************************
2 * ============LICENSE_START====================================================
4 * * ===========================================================================
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * * ===========================================================================
7 * * Licensed under the Apache License, Version 2.0 (the "License");
8 * * you may not use this file except in compliance with the License.
9 * * You may obtain a copy of the License at
11 * * http://www.apache.org/licenses/LICENSE-2.0
13 * * Unless required by applicable law or agreed to in writing, software
14 * * distributed under the License is distributed on an "AS IS" BASIS,
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * * See the License for the specific language governing permissions and
17 * * limitations under the License.
18 * * ============LICENSE_END====================================================
21 ******************************************************************************/
23 package org.onap.aaf.cadi.test;
25 import static org.junit.Assert.*;
27 import org.junit.Test;
28 import org.onap.aaf.cadi.CadiException;
30 import static org.hamcrest.CoreMatchers.is;
32 public class JU_CadiException {
34 public void testCadiException() {
35 CadiException exception = new CadiException();
37 assertNotNull(exception);
41 public void testCadiExceptionString() {
42 CadiException exception = new CadiException("New Exception");
43 assertNotNull(exception);
44 assertThat(exception.getMessage(), is("New Exception"));
48 public void testCadiExceptionThrowable() {
49 CadiException exception = new CadiException(new Throwable("New Exception"));
50 assertNotNull(exception);
51 assertThat(exception.getMessage(), is("java.lang.Throwable: New Exception"));
55 public void testCadiExceptionStringThrowable() {
56 CadiException exception = new CadiException("New Exception",new Throwable("New Exception"));
57 assertNotNull(exception);
58 assertThat(exception.getMessage(), is("New Exception"));
63 public void testCadiException1() {
64 CadiException exception = new CadiException();
66 assertNotNull(exception);
70 public void testCadiExceptionString1() {
71 CadiException exception = new CadiException("New Exception");
72 assertNotNull(exception);
73 assertThat(exception.getMessage(), is("New Exception"));
77 public void testCadiExceptionThrowable1() {
78 CadiException exception = new CadiException(new Throwable("New Exception"));
79 assertNotNull(exception);
80 assertThat(exception.getMessage(), is("java.lang.Throwable: New Exception"));
84 public void testCadiExceptionStringThrowable1() {
85 CadiException exception = new CadiException("New Exception",new Throwable("New Exception"));
86 assertNotNull(exception);
87 assertThat(exception.getMessage(), is("New Exception"));
92 public void testCadiException2() {
93 CadiException exception = new CadiException();
95 assertNotNull(exception);
99 public void testCadiExceptionString2() {
100 CadiException exception = new CadiException("New Exception");
101 assertNotNull(exception);
102 assertThat(exception.getMessage(), is("New Exception"));
106 public void testCadiExceptionThrowable2() {
107 CadiException exception = new CadiException(new Throwable("New Exception"));
108 assertNotNull(exception);
109 assertThat(exception.getMessage(), is("java.lang.Throwable: New Exception"));
113 public void testCadiExceptionStringThrowable2() {
114 CadiException exception = new CadiException("New Exception",new Throwable("New Exception"));
115 assertNotNull(exception);
116 assertThat(exception.getMessage(), is("New Exception"));