@Test public void shouldCallMapperDelegatorWhenSubDtoInfoExists() { Mockito.doReturn(Tag.class).when(tagDtoInfo).getEntityType(); defaultMapper.create(productDto); Mockito.verify(mapperDelegator, Mockito.times(2)).create(Mockito.any()); }
@SuppressWarnings("unchecked") @Override public Object create(Object from) { DtoInformation dtoInfo = dtoInfoRegistry.get(from.getClass()); if (dtoInfo.getType() == DtoType.MERGE) throw new IllegalStateException( "Cannot use merge dto to create entity"); return createByFields(from, dtoInfo); }
DefaultCreateAndUpdateMapper implements
		CreateMapper<Object, Object>, UpdateMapper<Object, Object> { @SuppressWarnings("unchecked") @Override public Object create(Object from) { DtoInformation dtoInfo = dtoInfoRegistry.get(from.getClass()); if (dtoInfo.getType() == DtoType.MERGE) throw new IllegalStateException( "Cannot use merge dto to create entity"); return createByFields(from, dtoInfo); } }
DefaultCreateAndUpdateMapper implements
		CreateMapper<Object, Object>, UpdateMapper<Object, Object> { @SuppressWarnings("unchecked") @Override public Object create(Object from) { DtoInformation dtoInfo = dtoInfoRegistry.get(from.getClass()); if (dtoInfo.getType() == DtoType.MERGE) throw new IllegalStateException( "Cannot use merge dto to create entity"); return createByFields(from, dtoInfo); } DefaultCreateAndUpdateMapper(DtoInformationRegistry dtoInfoRegistry,
			MapperDelegator mapperDelegator,
			PersistentEntities persistentEntities); }
DefaultCreateAndUpdateMapper implements
		CreateMapper<Object, Object>, UpdateMapper<Object, Object> { @SuppressWarnings("unchecked") @Override public Object create(Object from) { DtoInformation dtoInfo = dtoInfoRegistry.get(from.getClass()); if (dtoInfo.getType() == DtoType.MERGE) throw new IllegalStateException( "Cannot use merge dto to create entity"); return createByFields(from, dtoInfo); } DefaultCreateAndUpdateMapper(DtoInformationRegistry dtoInfoRegistry,
			MapperDelegator mapperDelegator,
			PersistentEntities persistentEntities); @SuppressWarnings("unchecked") @Override Object create(Object from); @Override void merge(Object from, Object entity); }
DefaultCreateAndUpdateMapper implements
		CreateMapper<Object, Object>, UpdateMapper<Object, Object> { @SuppressWarnings("unchecked") @Override public Object create(Object from) { DtoInformation dtoInfo = dtoInfoRegistry.get(from.getClass()); if (dtoInfo.getType() == DtoType.MERGE) throw new IllegalStateException( "Cannot use merge dto to create entity"); return createByFields(from, dtoInfo); } DefaultCreateAndUpdateMapper(DtoInformationRegistry dtoInfoRegistry,
			MapperDelegator mapperDelegator,
			PersistentEntities persistentEntities); @SuppressWarnings("unchecked") @Override Object create(Object from); @Override void merge(Object from, Object entity);  }