1
2
3
4
5
6
7
8
9
10
11 package org.mule;
12
13 import org.mule.config.i18n.MessageFactory;
14 import org.mule.impl.ImmutableMuleEndpoint;
15 import org.mule.tck.AbstractMuleTestCase;
16 import org.mule.umo.UMOException;
17 import org.mule.umo.endpoint.UMOImmutableEndpoint;
18 import org.mule.umo.manager.ManagerException;
19 import org.mule.umo.routing.RoutingException;
20
21 public class ExceptionsTestCase extends AbstractMuleTestCase
22 {
23
24 public void testExceptionChaining()
25 {
26 String rootMsg = "Root Test Exception Message";
27 String msg = "Test Exception Message";
28
29 Exception e = new ManagerException(MessageFactory.createStaticMessage(msg), new MuleException(
30 MessageFactory.createStaticMessage(rootMsg)));
31
32 assertEquals(rootMsg, e.getCause().getMessage());
33 assertEquals(msg, e.getMessage());
34 assertEquals(e.getClass().getName() + ": " + msg, e.toString());
35 }
36
37 public final void testRoutingExceptionNullUMOMessageNullUMOImmutableEndpoint() throws UMOException
38 {
39 RoutingException rex = new RoutingException(null, null);
40 assertNotNull(rex);
41 }
42
43 public final void testRoutingExceptionNullUMOMessageValidUMOImmutableEndpoint() throws UMOException
44 {
45 UMOImmutableEndpoint endpoint = new ImmutableMuleEndpoint("test://outbound", false);
46 assertNotNull(endpoint);
47
48 RoutingException rex = new RoutingException(null, endpoint);
49 assertNotNull(rex);
50 assertSame(endpoint, rex.getEndpoint());
51 }
52
53 }