2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 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
12 * http://www.apache.org/licenses/LICENSE-2.0
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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 package org.onap.aai.champcore.exceptions;
24 import static org.junit.Assert.assertTrue;
26 import org.junit.Test;
28 public class ChampExceptionTest {
31 public void testChampIndexNotExistsException() {
32 final ChampIndexNotExistsException e1 = new ChampIndexNotExistsException();
34 assertTrue(e1.getMessage() == null);
36 final ChampIndexNotExistsException e2 = new ChampIndexNotExistsException("foo");
38 assertTrue(e2.getMessage().equals("foo"));
40 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
42 assertTrue(e3.getCause().equals(e2));
44 final ChampIndexNotExistsException e4 = new ChampIndexNotExistsException("foo", e3);
46 assertTrue(e4.getMessage().equals("foo"));
47 assertTrue(e4.getCause().equals(e3));
51 public void testChampMarshallingException() {
52 final ChampMarshallingException e1 = new ChampMarshallingException();
54 assertTrue(e1.getMessage() == null);
56 final ChampMarshallingException e2 = new ChampMarshallingException("foo");
58 assertTrue(e2.getMessage().equals("foo"));
60 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
62 assertTrue(e3.getCause().equals(e2));
64 final ChampMarshallingException e4 = new ChampMarshallingException("foo", e3);
66 assertTrue(e4.getMessage().equals("foo"));
67 assertTrue(e4.getCause().equals(e3));
71 public void testChampObjectNotExistsException() {
72 final ChampObjectNotExistsException e1 = new ChampObjectNotExistsException();
74 assertTrue(e1.getMessage() == null);
76 final ChampObjectNotExistsException e2 = new ChampObjectNotExistsException("foo");
78 assertTrue(e2.getMessage().equals("foo"));
80 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
82 assertTrue(e3.getCause().equals(e2));
84 final ChampObjectNotExistsException e4 = new ChampObjectNotExistsException("foo", e3);
86 assertTrue(e4.getMessage().equals("foo"));
87 assertTrue(e4.getCause().equals(e3));
91 public void testChampRelationshipNotExistsException() {
92 final ChampRelationshipNotExistsException e1 = new ChampRelationshipNotExistsException();
94 assertTrue(e1.getMessage() == null);
96 final ChampRelationshipNotExistsException e2 = new ChampRelationshipNotExistsException("foo");
98 assertTrue(e2.getMessage().equals("foo"));
100 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
102 assertTrue(e3.getCause().equals(e2));
104 final ChampRelationshipNotExistsException e4 = new ChampRelationshipNotExistsException("foo", e3);
106 assertTrue(e4.getMessage().equals("foo"));
107 assertTrue(e4.getCause().equals(e3));
111 public void testChampSchemaViolationException() {
112 final ChampSchemaViolationException e1 = new ChampSchemaViolationException();
114 assertTrue(e1.getMessage() == null);
116 final ChampSchemaViolationException e2 = new ChampSchemaViolationException("foo");
118 assertTrue(e2.getMessage().equals("foo"));
120 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
122 assertTrue(e3.getCause().equals(e2));
124 final ChampSchemaViolationException e4 = new ChampSchemaViolationException("foo", e3);
126 assertTrue(e4.getMessage().equals("foo"));
127 assertTrue(e4.getCause().equals(e3));
131 public void testChampUnmarshallingException() {
132 final ChampUnmarshallingException e1 = new ChampUnmarshallingException();
134 assertTrue(e1.getMessage() == null);
136 final ChampUnmarshallingException e2 = new ChampUnmarshallingException("foo");
138 assertTrue(e2.getMessage().equals("foo"));
140 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
142 assertTrue(e3.getCause().equals(e2));
144 final ChampUnmarshallingException e4 = new ChampUnmarshallingException("foo", e3);
146 assertTrue(e4.getMessage().equals("foo"));
147 assertTrue(e4.getCause().equals(e3));