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