Map<String, MailClient> senders = beanDefinitionContext.getBeansOfType(MailClient.class);
Assert.assertEquals(senders.size(), 3);
// 1st mail sender
MailClient sender = senders.get("mailClient1");
Assert.assertEquals(sender.getName(), "mailClient1");
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getHost(), "localhost");
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getPort(), 25000);
Assert.assertNull(sender.getActor());
// 2nd mail sender
sender = senders.get("mailClient2");
Assert.assertEquals(sender.getName(), "mailClient2");
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getHost(), "localhost");
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getPort(), 25000);
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getUsername(), "mailus");
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getPassword(), "secret");
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getJavaMailProperties().get("mail.smtp.auth"), "true");
Assert.assertNull(sender.getActor());
// 3rd mail sender
sender = senders.get("mailClient3");
Assert.assertEquals(sender.getName(), "mailClient3");
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getHost(), "localhost");
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getPort(), 25000);
Assert.assertNotNull(sender.getActor());
Assert.assertEquals(sender.getEndpointConfiguration().getMessageConverter(), beanDefinitionContext.getBean("messageConverter", MessageConverter.class));
Assert.assertEquals(sender.getEndpointConfiguration().getJavaMailSender().getJavaMailProperties().get("mail.transport.protocol"), "smtp");
}