1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.dbcp2;
19
20 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
21 import static org.junit.jupiter.api.Assertions.assertEquals;
22 import static org.junit.jupiter.api.Assertions.assertNull;
23
24 import java.util.Arrays;
25 import java.util.List;
26
27 import org.junit.jupiter.api.Test;
28
29
30
31
32 public class TestListException {
33
34 @Test
35 public void testExceptionList() {
36 final List<Throwable> exceptions = Arrays.asList(new NullPointerException(), new RuntimeException());
37 final ListException list = new ListException("Internal Error", exceptions);
38 assertEquals("Internal Error", list.getMessage());
39 assertArrayEquals(exceptions.toArray(), list.getExceptionList().toArray());
40 }
41
42 @Test
43 public void testNulls() {
44 final ListException list = new ListException(null, null);
45 assertNull(list.getMessage());
46 assertNull(list.getExceptionList());
47 }
48 }