1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.shiro;
20
21 import junit.framework.TestCase;
22 import org.apache.shiro.util.ClassUtils;
23 import org.junit.Test;
24
25
26
27
28 @SuppressWarnings({"ThrowableInstanceNeverThrown"})
29 public abstract class ExceptionTest extends TestCase {
30
31 protected abstract Class getExceptionClass();
32
33 @Test
34 public void testNoArgConstructor() {
35 ClassUtils.newInstance(getExceptionClass());
36 }
37
38 @Test
39 public void testMsgConstructor() throws Exception {
40 ClassUtils.newInstance(getExceptionClass(), "Msg");
41 }
42
43 @Test
44 public void testCauseConstructor() throws Exception {
45 ClassUtils.newInstance(getExceptionClass(), new Throwable());
46 }
47
48 @Test
49 public void testMsgCauseConstructor() {
50 ClassUtils.newInstance(getExceptionClass(), "Msg", new Throwable());
51 }
52 }