Map<String, MailServer> servers = beanDefinitionContext.getBeansOfType(MailServer.class);
Assert.assertEquals(servers.size(), 3);
// 1st mail server
MailServer server = servers.get("mailServer1");
Assert.assertEquals(server.getName(), "mailServer1");
Assert.assertEquals(server.getPort(), 25);
Assert.assertFalse(server.isAutoStart());
Assert.assertFalse(server.isSplitMultipart());
Assert.assertTrue(server.isAutoAccept());
Assert.assertEquals(server.getEndpointAdapter().getClass(), ChannelEndpointAdapter.class);
Assert.assertTrue(server.getJavaMailProperties().isEmpty());
// 2nd mail server
server = servers.get("mailServer2");
Assert.assertEquals(server.getName(), "mailServer2");
Assert.assertEquals(server.getPort(), 25000);
Assert.assertFalse(server.isAutoStart());
Assert.assertFalse(server.isSplitMultipart());
Assert.assertFalse(server.isAutoAccept());
Assert.assertTrue(server.getJavaMailProperties().isEmpty());
// 3rd mail server
server = servers.get("mailServer3");
Assert.assertEquals(server.getName(), "mailServer3");
Assert.assertEquals(server.getPort(), 25);
Assert.assertFalse(server.isAutoStart());
Assert.assertTrue(server.isSplitMultipart());
Assert.assertTrue(server.isAutoAccept());
Assert.assertEquals(server.getEndpointAdapter(), beanDefinitionContext.getBean("endpointAdapter"));
Assert.assertEquals(server.getJavaMailProperties(), beanDefinitionContext.getBean("mailProperties"));
Assert.assertEquals(server.getMessageConverter(), beanDefinitionContext.getBean("messageConverter", MessageConverter.class));
Assert.assertFalse(server.getJavaMailProperties().isEmpty());
}