use of org.nhind.testutils.MockMailetConfig in project nhin-d by DirectProject.
the class NHINDMailetTest method testInit.
/**
* Test the init method.
*/
public void testInit() {
final String endpointUrl = "http://www.endpoint.url/";
DirectXdMailet mailet = new DirectXdMailet();
Map<String, String> params = new HashMap<String, String>();
params.put("EndpointURL", endpointUrl);
MailetConfig mailetConfig = new MockMailetConfig(params, "MailetName");
try {
mailet.init(mailetConfig);
} catch (MessagingException e) {
fail("Test setup failed");
}
try {
mailet.init();
assertEquals("EndpointURL value does not match expected", endpointUrl, mailet.getEndpointUrl());
} catch (MessagingException e) {
fail("Exception thrown");
}
try {
params.clear();
params.put("EndpointURL", "");
mailet.init();
fail("Exception not thrown");
} catch (MessagingException e) {
assertTrue(true);
}
try {
params.clear();
mailet.init();
fail("Exception not thrown");
} catch (MessagingException e) {
assertTrue(true);
}
}
Aggregations