.dto(MyDtoWithSameFieldsClass.class).forEntity("myEntityWithSameFields")
// map all same name same type fields by key but not field4, field5, field6, field7
.withFieldsSameAsIn("myEntityWithSameFields", "field4", "field5", "field6", "field7");
final Assembler asm = DTOAssembler.newAssembler(MyDtoWithSameFieldsClass.class, MyEntityWithSameFieldsInterface.class, registry);
final MyEntityWithSameFieldsInterface fromEntity = new MyEntityWithSameFieldsClass();
fromEntity.setField1("field1");
fromEntity.setField2(Boolean.TRUE);
fromEntity.setField3(true);
fromEntity.setField4(Integer.valueOf(4));
fromEntity.setField5(5);
fromEntity.setField6(Long.valueOf(6L));
fromEntity.setField7(7L);
fromEntity.setField8(Double.valueOf(8D));
fromEntity.setField9(9D);
fromEntity.setField10(BigDecimal.TEN);
final Object field11Obj = new Object();
fromEntity.setField11(field11Obj);
fromEntity.setWrongNameOnEntity("wrongNameOnEntity");
fromEntity.setWrongType(Double.valueOf(20D));
final MyDtoWithSameFieldsClass dto = new MyDtoWithSameFieldsClass();
asm.assembleDto(dto, fromEntity, null, bf);
assertEquals(dto.getField1(), "field1");
assertTrue(dto.getField2());
assertTrue(dto.getField3());
assertNull(dto.getField4());
assertEquals(dto.getField5(), 0);
assertNull(dto.getField6());
assertEquals(dto.getField7(), 0L);
assertEquals(dto.getField8(), Double.valueOf(8D));
assertEquals(dto.getField9(), 9D, 0);
assertEquals(BigDecimal.TEN.compareTo(dto.getField10()), 0);
assertSame(dto.getField11(), field11Obj);
assertNull(dto.getWrongName());
assertNull(dto.getWrongType());
dto.setField4(Integer.valueOf(4));
dto.setField5(5);
dto.setField6(Long.valueOf(6L));
dto.setField7(7L);
final MyEntityWithSameFieldsInterface toEntity = new MyEntityWithSameFieldsClass();
asm.assembleEntity(dto, toEntity, null, bf);
assertEquals(toEntity.getField1(), "field1");
assertTrue(toEntity.getField2());
assertTrue(toEntity.getField3());
assertNull(toEntity.getField4());