2 * ============LICENSE_START==========================================
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
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============================================
21 package org.onap.aai.champcore.exceptions;
23 import static org.junit.Assert.assertTrue;
25 import org.junit.Test;
27 public class ChampExceptionTest {
30 public void testChampIndexNotExistsException() {
31 final ChampIndexNotExistsException e1 = new ChampIndexNotExistsException();
33 assertTrue(e1.getMessage() == null);
35 final ChampIndexNotExistsException e2 = new ChampIndexNotExistsException("foo");
37 assertTrue(e2.getMessage().equals("foo"));
39 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
41 assertTrue(e3.getCause().equals(e2));
43 final ChampIndexNotExistsException e4 = new ChampIndexNotExistsException("foo", e3);
45 assertTrue(e4.getMessage().equals("foo"));
46 assertTrue(e4.getCause().equals(e3));
50 public void testChampMarshallingException() {
51 final ChampMarshallingException e1 = new ChampMarshallingException();
53 assertTrue(e1.getMessage() == null);
55 final ChampMarshallingException e2 = new ChampMarshallingException("foo");
57 assertTrue(e2.getMessage().equals("foo"));
59 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
61 assertTrue(e3.getCause().equals(e2));
63 final ChampMarshallingException e4 = new ChampMarshallingException("foo", e3);
65 assertTrue(e4.getMessage().equals("foo"));
66 assertTrue(e4.getCause().equals(e3));
70 public void testChampObjectNotExistsException() {
71 final ChampObjectNotExistsException e1 = new ChampObjectNotExistsException();
73 assertTrue(e1.getMessage() == null);
75 final ChampObjectNotExistsException e2 = new ChampObjectNotExistsException("foo");
77 assertTrue(e2.getMessage().equals("foo"));
79 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
81 assertTrue(e3.getCause().equals(e2));
83 final ChampObjectNotExistsException e4 = new ChampObjectNotExistsException("foo", e3);
85 assertTrue(e4.getMessage().equals("foo"));
86 assertTrue(e4.getCause().equals(e3));
90 public void testChampRelationshipNotExistsException() {
91 final ChampRelationshipNotExistsException e1 = new ChampRelationshipNotExistsException();
93 assertTrue(e1.getMessage() == null);
95 final ChampRelationshipNotExistsException e2 = new ChampRelationshipNotExistsException("foo");
97 assertTrue(e2.getMessage().equals("foo"));
99 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
101 assertTrue(e3.getCause().equals(e2));
103 final ChampRelationshipNotExistsException e4 = new ChampRelationshipNotExistsException("foo", e3);
105 assertTrue(e4.getMessage().equals("foo"));
106 assertTrue(e4.getCause().equals(e3));
110 public void testChampSchemaViolationException() {
111 final ChampSchemaViolationException e1 = new ChampSchemaViolationException();
113 assertTrue(e1.getMessage() == null);
115 final ChampSchemaViolationException e2 = new ChampSchemaViolationException("foo");
117 assertTrue(e2.getMessage().equals("foo"));
119 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
121 assertTrue(e3.getCause().equals(e2));
123 final ChampSchemaViolationException e4 = new ChampSchemaViolationException("foo", e3);
125 assertTrue(e4.getMessage().equals("foo"));
126 assertTrue(e4.getCause().equals(e3));
130 public void testChampUnmarshallingException() {
131 final ChampUnmarshallingException e1 = new ChampUnmarshallingException();
133 assertTrue(e1.getMessage() == null);
135 final ChampUnmarshallingException e2 = new ChampUnmarshallingException("foo");
137 assertTrue(e2.getMessage().equals("foo"));
139 final ChampIndexNotExistsException e3 = new ChampIndexNotExistsException(e2);
141 assertTrue(e3.getCause().equals(e2));
143 final ChampUnmarshallingException e4 = new ChampUnmarshallingException("foo", e3);
145 assertTrue(e4.getMessage().equals("foo"));
146 assertTrue(e4.getCause().equals(e3));