use of org.apache.mailet.MatcherConfig in project nhin-d by DirectProject.
the class RecipAndSenderIsNotLocalTest method testMatch_RemoteSender_AssertRecipeintReturned.
public void testMatch_RemoteSender_AssertRecipeintReturned() throws Exception {
final Mail mockMail = mock(Mail.class);
when(mockMail.getSender()).thenReturn(new MailAddress("me@remoteMail.com"));
when(mockMail.getRecipients()).thenReturn(Arrays.asList(new MailAddress("you@cerner.com")));
final MatcherConfig newConfig = mock(MatcherConfig.class);
when(newConfig.getCondition()).thenReturn("cerner.com");
RecipAndSenderIsNotLocal matcher = new RecipAndSenderIsNotLocal();
matcher.init(newConfig);
Collection<MailAddress> matchAddresses = matcher.match(mockMail);
assertEquals(1, matchAddresses.size());
assertEquals("you@cerner.com", matchAddresses.iterator().next().toString());
}
Aggregations