1
2
3
4
5
6
7 package org.abraracourcix.alipes.common.messaging;
8
9 import junit.framework.TestCase;
10
11 /***
12 * Trivial tests of exception.
13 *
14 * @author jdt
15 */
16 public final class MessengerExceptionTest extends TestCase {
17 /***
18 * Run the text ui
19 * @param args ingored
20 */
21 public static void main(final String[] args) {
22 junit.textui.TestRunner.run(MessengerExceptionTest.class);
23 }
24 /***
25 * Class to test for void MessengerException()
26 */
27 public void testMessengerException() {
28 new MessengerException();
29 }
30 /***
31 * Class to test for void MessengerException(String)
32 */
33 public void testMessengerExceptionString() {
34 final Exception ex = new MessengerException("fred");
35 assertEquals(ex.getMessage(), "fred");
36 }
37 /***
38 * Class to test for void MessengerException(Throwable)
39 */
40 public void testMessengerExceptionThrowable() {
41 final Exception ex2 = new Exception();
42 final Exception ex = new MessengerException(ex2);
43 assertEquals(ex.getCause(), ex2);
44 }
45 /***
46 * Class to test for void MessengerException(String, Throwable)
47 */
48 public void testMessengerExceptionStringThrowable() {
49 final Exception ex2 = new Exception();
50 final Exception ex = new MessengerException("fred",ex2);
51 assertEquals(ex.getCause(), ex2);
52 assertEquals(ex.getMessage(), "fred");
53 }
54 }
55
56
57
58
59
60
61
62
63
64
65