fa3b5cc4dbcde2458f74fbea7294cc3713376eda
[aaf/authz.git] / cadi / core / src / test / java / org / onap / aaf / cadi / test / JU_CadiException.java
1 /*******************************************************************************\r
2  * ============LICENSE_START====================================================\r
3  * * org.onap.aaf\r
4  * * ===========================================================================\r
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * * ===========================================================================\r
7  * * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * * you may not use this file except in compliance with the License.\r
9  * * You may obtain a copy of the License at\r
10  * * \r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * * \r
13  *  * Unless required by applicable law or agreed to in writing, software\r
14  * * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * * See the License for the specific language governing permissions and\r
17  * * limitations under the License.\r
18  * * ============LICENSE_END====================================================\r
19  * *\r
20  * *\r
21  ******************************************************************************/\r
22 package org.onap.aaf.cadi.test;\r
23 \r
24 import static org.junit.Assert.*;\r
25 \r
26 import org.junit.Test;\r
27 import org.onap.aaf.cadi.CadiException;\r
28 \r
29 import static org.hamcrest.CoreMatchers.is;\r
30 \r
31 public class JU_CadiException {\r
32         @Test\r
33         public void testCadiException() {\r
34                 CadiException exception = new CadiException();\r
35                 \r
36                 assertNotNull(exception);\r
37         }\r
38 \r
39         @Test\r
40         public void testCadiExceptionString() {\r
41                 CadiException exception = new CadiException("New Exception");\r
42                 assertNotNull(exception);\r
43                 assertThat(exception.getMessage(), is("New Exception"));\r
44         }\r
45 \r
46         @Test\r
47         public void testCadiExceptionThrowable() {\r
48                 CadiException exception = new CadiException(new Throwable("New Exception"));\r
49                 assertNotNull(exception);\r
50                 assertThat(exception.getMessage(), is("java.lang.Throwable: New Exception"));\r
51         }\r
52 \r
53         @Test\r
54         public void testCadiExceptionStringThrowable() {\r
55                 CadiException exception = new CadiException("New Exception",new Throwable("New Exception"));\r
56                 assertNotNull(exception);\r
57                 assertThat(exception.getMessage(), is("New Exception"));\r
58 \r
59         }\r
60         \r
61         @Test\r
62         public void testCadiException1() {\r
63                 CadiException exception = new CadiException();\r
64                 \r
65                 assertNotNull(exception);\r
66         }\r
67 \r
68         @Test\r
69         public void testCadiExceptionString1() {\r
70                 CadiException exception = new CadiException("New Exception");\r
71                 assertNotNull(exception);\r
72                 assertThat(exception.getMessage(), is("New Exception"));\r
73         }\r
74 \r
75         @Test\r
76         public void testCadiExceptionThrowable1() {\r
77                 CadiException exception = new CadiException(new Throwable("New Exception"));\r
78                 assertNotNull(exception);\r
79                 assertThat(exception.getMessage(), is("java.lang.Throwable: New Exception"));\r
80         }\r
81 \r
82         @Test\r
83         public void testCadiExceptionStringThrowable1() {\r
84                 CadiException exception = new CadiException("New Exception",new Throwable("New Exception"));\r
85                 assertNotNull(exception);\r
86                 assertThat(exception.getMessage(), is("New Exception"));\r
87 \r
88         }\r
89         \r
90         @Test\r
91         public void testCadiException2() {\r
92                 CadiException exception = new CadiException();\r
93                 \r
94                 assertNotNull(exception);\r
95         }\r
96 \r
97         @Test\r
98         public void testCadiExceptionString2() {\r
99                 CadiException exception = new CadiException("New Exception");\r
100                 assertNotNull(exception);\r
101                 assertThat(exception.getMessage(), is("New Exception"));\r
102         }\r
103 \r
104         @Test\r
105         public void testCadiExceptionThrowable2() {\r
106                 CadiException exception = new CadiException(new Throwable("New Exception"));\r
107                 assertNotNull(exception);\r
108                 assertThat(exception.getMessage(), is("java.lang.Throwable: New Exception"));\r
109         }\r
110 \r
111         @Test\r
112         public void testCadiExceptionStringThrowable2() {\r
113                 CadiException exception = new CadiException("New Exception",new Throwable("New Exception"));\r
114                 assertNotNull(exception);\r
115                 assertThat(exception.getMessage(), is("New Exception"));\r
116 \r
117         }\r
118 \r
119 \r
120 \r
121 }\r