1
2
3
4
5
6
7
8
9
10 package org.mule.transport.email.config;
11
12 import org.mule.api.MuleException;
13 import org.mule.api.endpoint.ImmutableEndpoint;
14 import org.mule.tck.junit4.FunctionalTestCase;
15
16 import static org.junit.Assert.assertEquals;
17 import static org.junit.Assert.assertNotNull;
18
19 public abstract class AbstractEmailNamespaceHandlerTestCase extends FunctionalTestCase
20 {
21
22 protected void testInboundEndpoint(String name, String protocolName) throws MuleException
23 {
24 ImmutableEndpoint endpoint =
25 muleContext.getEndpointFactory().getInboundEndpoint(name);
26 testEndpoint(endpoint, protocolName);
27 }
28
29 protected void testOutboundEndpoint(String name, String protocolName) throws MuleException
30 {
31 ImmutableEndpoint endpoint =
32 muleContext.getEndpointFactory().getOutboundEndpoint(name);
33 testEndpoint(endpoint, protocolName);
34 }
35
36 private void testEndpoint(ImmutableEndpoint endpoint, String protocolName)
37 {
38 assertNotNull(endpoint);
39 String address = endpoint.getEndpointURI().getAddress();
40 assertNotNull(address);
41 assertEquals("bob@localhost:123", address);
42 String password = endpoint.getEndpointURI().getPassword();
43 assertNotNull(password);
44 assertEquals("secret", password);
45 String protocol = endpoint.getProtocol();
46 assertNotNull(protocol);
47 assertEquals(protocolName, protocol);
48 }
49 }