@Test void toEntityTypeAttrs() { EntityType entityType = mock(EntityType.class); Map<String, Object> valueMap = new HashMap<>(); Map<String, Object> attrMap1 = new HashMap<>(); Map<String, Object> attrMap2 = new HashMap<>(); valueMap.put("attributes", Arrays.asList(attrMap1, attrMap2)); Map<String, Attribute> attrs = new HashMap<>(); Attribute attr1 = mock(Attribute.class); Attribute attr2 = mock(Attribute.class); attrs.put("1", attr1); attrs.put("2", attr2); when(attributeRequestMapper.toAttributes(Arrays.asList(attrMap1, attrMap2), entityType)) .thenReturn(attrs); entityTypeRequestMapper.updateEntityType(entityType, valueMap); verify(entityType).setOwnAllAttributes(attrs.values()); }
@Override public void updateEntityType(EntityType entityType, Map<String, Object> entityTypeValues) { for (Entry<String, Object> entry : entityTypeValues.entrySet()) { if (entry.getValue() == null) { entityType.set(entry.getKey(), null); } else { updateEntityType(entityType, entry); } } }
EntityTypeRequestMapperImpl implements EntityTypeRequestMapper { @Override public void updateEntityType(EntityType entityType, Map<String, Object> entityTypeValues) { for (Entry<String, Object> entry : entityTypeValues.entrySet()) { if (entry.getValue() == null) { entityType.set(entry.getKey(), null); } else { updateEntityType(entityType, entry); } } } }
EntityTypeRequestMapperImpl implements EntityTypeRequestMapper { @Override public void updateEntityType(EntityType entityType, Map<String, Object> entityTypeValues) { for (Entry<String, Object> entry : entityTypeValues.entrySet()) { if (entry.getValue() == null) { entityType.set(entry.getKey(), null); } else { updateEntityType(entityType, entry); } } } EntityTypeRequestMapperImpl(
      EntityTypeFactory entityTypeFactory,
      AttributeRequestMapper attributeRequestMapper,
      MetaDataService metaDataService); }
EntityTypeRequestMapperImpl implements EntityTypeRequestMapper { @Override public void updateEntityType(EntityType entityType, Map<String, Object> entityTypeValues) { for (Entry<String, Object> entry : entityTypeValues.entrySet()) { if (entry.getValue() == null) { entityType.set(entry.getKey(), null); } else { updateEntityType(entityType, entry); } } } EntityTypeRequestMapperImpl(
      EntityTypeFactory entityTypeFactory,
      AttributeRequestMapper attributeRequestMapper,
      MetaDataService metaDataService); @Override EntityType toEntityType(CreateEntityTypeRequest entityTypeRequest); @Override void updateEntityType(EntityType entityType, Map<String, Object> entityTypeValues); }
EntityTypeRequestMapperImpl implements EntityTypeRequestMapper { @Override public void updateEntityType(EntityType entityType, Map<String, Object> entityTypeValues) { for (Entry<String, Object> entry : entityTypeValues.entrySet()) { if (entry.getValue() == null) { entityType.set(entry.getKey(), null); } else { updateEntityType(entityType, entry); } } } EntityTypeRequestMapperImpl(
      EntityTypeFactory entityTypeFactory,
      AttributeRequestMapper attributeRequestMapper,
      MetaDataService metaDataService); @Override EntityType toEntityType(CreateEntityTypeRequest entityTypeRequest); @Override void updateEntityType(EntityType entityType, Map<String, Object> entityTypeValues);  }