2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2018 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
11 * http://www.apache.org/licenses/LICENSE-2.0
\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
20 package org.onap.appc.pool;
\r
22 import org.junit.Assert;
\r
24 import org.junit.Test;
\r
26 public class PoolExceptionTest {
\r
29 public void testPoolException() {
\r
30 PoolException poolException = new PoolException();
\r
31 Assert.assertTrue(poolException.getCause() == null);
\r
32 Assert.assertTrue(poolException.getMessage() == null);
\r
36 public void testPoolExceptionString() {
\r
37 String message = "test message";
\r
38 PoolException poolException = new PoolException(message);
\r
39 Assert.assertEquals(message, poolException.getMessage());
\r
40 Assert.assertEquals(message, poolException.getLocalizedMessage());
\r
44 public void testPoolExceptionThrowable() {
\r
45 String tMessage = "throwable message";
\r
46 Throwable throwable = new Throwable(tMessage);
\r
47 PoolException poolException = new PoolException(throwable);
\r
48 Assert.assertEquals(throwable, poolException.getCause());
\r
52 public void testPoolExceptionStringThrowable() {
\r
53 String message = "my test message";
\r
54 String tMessage = "throwable message";
\r
55 Throwable throwable = new Throwable(tMessage);
\r
56 PoolException poolException = new PoolException(message, throwable);
\r
57 Assert.assertEquals(throwable, poolException.getCause());
\r
58 Assert.assertTrue(poolException.getMessage().contains(message));
\r
59 Assert.assertEquals(message, poolException.getLocalizedMessage());
\r
63 public void testPoolExceptionStringThrowableBooleanBoolean() {
\r
64 String message = "my test message";
\r
65 String tMessage = "throwable message";
\r
66 Throwable throwable = new Throwable(tMessage);
\r
67 PoolException poolException = new PoolException(message, throwable, true, true);
\r
68 Assert.assertEquals(throwable, poolException.getCause());
\r
69 Assert.assertTrue(poolException.getMessage().contains(message));
\r
70 Assert.assertEquals(message, poolException.getLocalizedMessage());
\r