final TestDto12CollectionIterface dColl = new TestDto12CollectionClass();
final Assembler assembler = DTOAssembler.newCustomAssembler(dColl.getClass(), eWrap.getClass(), synthesizer);
assembler.assembleDto(dColl, eWrap, null, new BeanFactory() {
public Class getClazz(final String entityBeanKey) {
return null;
}
public Object get(final String entityBeanKey) {
if ("dtoItem".equals(entityBeanKey)) {
return new TestDto12CollectionItemClass();
}
return null;
}
});
assertNotNull(dColl.getItems());
assertEquals(2, dColl.getItems().size());
Iterator<TestDto12CollectionItemIterface> iter;
iter = dColl.getItems().iterator();
final TestDto12CollectionItemIterface dto1 = iter.next();
final TestDto12CollectionItemIterface dto2 = iter.next();
assertEquals("itm1", dto1.getName());
assertEquals("itm2", dto2.getName());
final TestDto12CollectionItemClass dto3 = new TestDto12CollectionItemClass();
dto3.setName("itm3");
dColl.getItems().add(dto3);
iter = dColl.getItems().iterator();
iter.next();
iter.remove(); // first
assembler.assembleEntity(dColl, eWrap, null, new BeanFactory() {
public Class getClazz(final String entityBeanKey) {
return null;
}