1 package trafficcontrol;
2
3 import static org.junit.jupiter.api.Assertions.assertEquals;
4 import static org.junit.jupiter.api.Assertions.assertNotNull;
5
6 import org.junit.jupiter.api.Test;
7 import org.opentrafficsim.trafficcontrol.TrafficControlException;
8
9
10
11
12
13
14
15
16
17
18
19 public class TrafficControlExceptionTest
20 {
21
22
23
24
25 @Test
26 public final void trafficControlExceptionTest()
27 {
28 TrafficControlException e = new TrafficControlException();
29 assertNotNull(e, "result should not be null");
30 String message = "test message";
31 e = new TrafficControlException(message);
32 assertEquals(message, e.getMessage(), "message should be " + message);
33 String causeMessage = "cause message";
34 Throwable cause = new Throwable(causeMessage);
35 e = new TrafficControlException(cause);
36 assertEquals(causeMessage, e.getCause().getMessage(), "cause message should be" + causeMessage);
37 e = new TrafficControlException(message, cause);
38 assertEquals(message, e.getMessage(), "message should be " + message);
39 assertEquals(causeMessage, e.getCause().getMessage(), "cause message should be" + causeMessage);
40 e = new TrafficControlException(message, cause, false, false);
41 assertEquals(message, e.getMessage(), "message should be " + message);
42 assertEquals(causeMessage, e.getCause().getMessage(), "cause message should be" + causeMessage);
43
44 e = new TrafficControlException(message, cause, false, true);
45 assertEquals(message, e.getMessage(), "message should be " + message);
46 assertEquals(causeMessage, e.getCause().getMessage(), "cause message should be" + causeMessage);
47 e = new TrafficControlException(message, cause, true, false);
48 assertEquals(message, e.getMessage(), "message should be " + message);
49 assertEquals(causeMessage, e.getCause().getMessage(), "cause message should be" + causeMessage);
50 e = new TrafficControlException(message, cause, true, true);
51 assertEquals(message, e.getMessage(), "message should be " + message);
52 assertEquals(causeMessage, e.getCause().getMessage(), "cause message should be" + causeMessage);
53 }
54
55 }