use of com.amazonaws.services.rds.model.ListTagsForResourceResult in project spring-cloud-aws by awspring.
the class AmazonRdsDataSourceUserTagsFactoryBeanTest method getObject_instanceWithOutTags_emptyMapReturned.
@Test
void getObject_instanceWithOutTags_emptyMapReturned() throws Exception {
// Arrange
AmazonRDS amazonRds = mock(AmazonRDS.class);
ResourceIdResolver resourceIdResolver = mock(ResourceIdResolver.class);
AmazonIdentityManagement amazonIdentityManagement = mock(AmazonIdentityManagement.class);
AmazonRdsDataSourceUserTagsFactoryBean factoryBean = new AmazonRdsDataSourceUserTagsFactoryBean(amazonRds, "test", amazonIdentityManagement);
factoryBean.setResourceIdResolver(resourceIdResolver);
factoryBean.setResourceIdResolver(resourceIdResolver);
factoryBean.setRegion(Region.getRegion(Regions.EU_WEST_1));
when(resourceIdResolver.resolveToPhysicalResourceId("test")).thenReturn("stack-test");
when(amazonIdentityManagement.getUser()).thenReturn(new GetUserResult().withUser(new User("/", "aemruli", "123456789012", "arn:aws:iam::1234567890:user/aemruli", new Date())));
when(amazonRds.listTagsForResource(new ListTagsForResourceRequest().withResourceName("arn:aws:rds:eu-west-1:1234567890:db:stack-test"))).thenReturn(new ListTagsForResourceResult());
// Act
factoryBean.afterPropertiesSet();
Map<String, String> userTagMap = factoryBean.getObject();
// Assert
assertThat(userTagMap.isEmpty()).isTrue();
}
Aggregations