@Test public void parseInternal_withDefaultDestination_mustBeSetOnTemplate() throws Exception { // Arrange SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry); // Act reader.loadBeanDefinitions( new ClassPathResource( getClass().getSimpleName() + "-with-default-destination.xml", getClass())); // Assert BeanDefinition notificationMessagingTemplateBeanDefinition = registry.getBeanDefinition("notificationMessagingTemplate"); assertEquals( "myDefaultDestination", notificationMessagingTemplateBeanDefinition .getPropertyValues() .getPropertyValue("defaultDestinationName") .getValue()); }
@Test public void parseInternal_withCustomAmazonSnsClient_shouldPassItAsConstructorArg() throws Exception { // Arrange SimpleBeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(registry); // Act reader.loadBeanDefinitions( new ClassPathResource(getClass().getSimpleName() + "-custom-amazon-sns.xml", getClass())); // Assert BeanDefinition notificationMessagingTemplateBeanDefinition = registry.getBeanDefinition("notificationMessagingTemplate"); assertEquals( "mySnsClient", ((RuntimeBeanReference) notificationMessagingTemplateBeanDefinition .getConstructorArgumentValues() .getArgumentValue(0, RuntimeBeanReference.class) .getValue()) .getBeanName()); }