Update license date and text
[aai/champ.git] / champ-lib / champ-core / src / test / java / org / onap / aai / champcore / exceptions / ChampExceptionTest.java
1 /**
2  * ============LICENSE_START==========================================
3  * org.onap.aai
4  * ===================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Amdocs
7  * ===================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *        http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  */
21 package org.onap.aai.champcore.exceptions;
22
23 import static org.junit.Assert.assertTrue;
24
25 import org.junit.Test;
26
27 public class ChampExceptionTest {
28
29         @Test
30         public void testChampIndexNotExistsException() {
31                 final ChampIndexNotExistsException e1 = new ChampIndexNotExistsException();
32
33                 assertTrue(e1.getMessage() == null);
34
35                 final ChampIndexNotExistsException e2 = new ChampIndexNotExistsException("foo");
36
37                 assertTrue(e2.getMessage().equals("foo"));
38
39                 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
40
41                 assertTrue(e3.getCause().equals(e2));
42
43                 final ChampIndexNotExistsException e4 = new ChampIndexNotExistsException("foo", e3);
44
45                 assertTrue(e4.getMessage().equals("foo"));
46                 assertTrue(e4.getCause().equals(e3));
47         }
48
49         @Test
50         public void testChampMarshallingException() {
51                 final ChampMarshallingException e1 = new ChampMarshallingException();
52
53                 assertTrue(e1.getMessage() == null);
54
55                 final ChampMarshallingException e2 = new ChampMarshallingException("foo");
56
57                 assertTrue(e2.getMessage().equals("foo"));
58
59                 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
60
61                 assertTrue(e3.getCause().equals(e2));
62
63                 final ChampMarshallingException e4 = new ChampMarshallingException("foo", e3);
64
65                 assertTrue(e4.getMessage().equals("foo"));
66                 assertTrue(e4.getCause().equals(e3));
67         }
68
69         @Test
70         public void testChampObjectNotExistsException() {
71                 final ChampObjectNotExistsException e1 = new ChampObjectNotExistsException();
72
73                 assertTrue(e1.getMessage() == null);
74
75                 final ChampObjectNotExistsException e2 = new ChampObjectNotExistsException("foo");
76
77                 assertTrue(e2.getMessage().equals("foo"));
78
79                 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
80
81                 assertTrue(e3.getCause().equals(e2));
82
83                 final ChampObjectNotExistsException e4 = new ChampObjectNotExistsException("foo", e3);
84
85                 assertTrue(e4.getMessage().equals("foo"));
86                 assertTrue(e4.getCause().equals(e3));
87         }
88
89         @Test
90         public void testChampRelationshipNotExistsException() {
91                 final ChampRelationshipNotExistsException e1 = new ChampRelationshipNotExistsException();
92
93                 assertTrue(e1.getMessage() == null);
94
95                 final ChampRelationshipNotExistsException e2 = new ChampRelationshipNotExistsException("foo");
96
97                 assertTrue(e2.getMessage().equals("foo"));
98
99                 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
100
101                 assertTrue(e3.getCause().equals(e2));
102
103                 final ChampRelationshipNotExistsException e4 = new ChampRelationshipNotExistsException("foo", e3);
104
105                 assertTrue(e4.getMessage().equals("foo"));
106                 assertTrue(e4.getCause().equals(e3));
107         }
108
109         @Test
110         public void testChampSchemaViolationException() {
111                 final ChampSchemaViolationException e1 = new ChampSchemaViolationException();
112
113                 assertTrue(e1.getMessage() == null);
114
115                 final ChampSchemaViolationException e2 = new ChampSchemaViolationException("foo");
116
117                 assertTrue(e2.getMessage().equals("foo"));
118
119                 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
120
121                 assertTrue(e3.getCause().equals(e2));
122
123                 final ChampSchemaViolationException e4 = new ChampSchemaViolationException("foo", e3);
124
125                 assertTrue(e4.getMessage().equals("foo"));
126                 assertTrue(e4.getCause().equals(e3));
127         }
128
129         @Test
130         public void testChampUnmarshallingException() {
131                 final ChampUnmarshallingException e1 = new ChampUnmarshallingException();
132
133                 assertTrue(e1.getMessage() == null);
134
135                 final ChampUnmarshallingException e2 = new ChampUnmarshallingException("foo");
136
137                 assertTrue(e2.getMessage().equals("foo"));
138
139                 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
140
141                 assertTrue(e3.getCause().equals(e2));
142
143                 final ChampUnmarshallingException e4 = new ChampUnmarshallingException("foo", e3);
144
145                 assertTrue(e4.getMessage().equals("foo"));
146                 assertTrue(e4.getCause().equals(e3));
147         }
148
149 }