return factory.getMapperFacade();
}
@Test
public void testMergingWithCustomMapperForChildren() {
MapperFacade mapper = createMapperFacade();
List<ChildDto> dtos = new ArrayList<ChildDto>();
ChildDto dto = new ChildDto();
dto.setId(1L);
dto.setName("A");
dtos.add(dto);
ChildDto dto2 = new ChildDto();
dto2.setId(2L);
dto2.setName("B");
dtos.add(dto2);
dto = new ChildDto();
dto.setId(3L);
dto.setName("C");
dtos.add(dto);
AnotherDtoHolder source = new AnotherDtoHolder();
source.setEntities(dtos);
Type<?> typeOf_DtoHolder = TypeFactory.valueOf(DtoHolder.class);
UtilityResolver.getDefaultPropertyResolverStrategy().getProperties(typeOf_DtoHolder);
final AnotherEntityHolder entities = mapper.map(source, AnotherEntityHolder.class);
Assert.assertNotNull(entities);
Assert.assertEquals(3, entities.getEntities().size());
final AnotherEntityHolder originalEntities = entities;
source.getEntities().remove(dto2);
dto2.setName("B-Changed");
source.getEntities().add(dto2);
mapper.map(source, entities);
Assert.assertEquals(entities.getEntities().size(), originalEntities.getEntities().size());
Iterator<ChildEntity> entitiesIter = entities.getEntities().iterator();
Iterator<ChildEntity> originalIter = originalEntities.getEntities().iterator();