@Test void testDeleteAttribute() { String entityTypeId = "entityTypeId"; EntityType entityType = mock(EntityType.class); when(metadataService.getEntityType(entityTypeId)).thenReturn(Optional.of(entityType)); String attributeId = "attr1"; Attribute attr = mock(Attribute.class); when(entityType.getOwnAttributeById(attributeId)).thenReturn(attr); metadataApiService.deleteAttributeAsync(entityTypeId, attributeId); assertAll( () -> verify(entityType).removeAttribute(attr), () -> verify(metadataApiJobService).scheduleUpdate(entityType)); }
@Override public MetadataUpsertJobExecution deleteAttributeAsync(String entityTypeId, String attributeId) { EntityType entityType = findEntityType(entityTypeId); Attribute attribute = entityType.getOwnAttributeById(attributeId); entityType.removeAttribute(attribute); return metadataApiJobService.scheduleUpdate(entityType); }
MetadataApiServiceImpl implements MetadataApiService { @Override public MetadataUpsertJobExecution deleteAttributeAsync(String entityTypeId, String attributeId) { EntityType entityType = findEntityType(entityTypeId); Attribute attribute = entityType.getOwnAttributeById(attributeId); entityType.removeAttribute(attribute); return metadataApiJobService.scheduleUpdate(entityType); } }
MetadataApiServiceImpl implements MetadataApiService { @Override public MetadataUpsertJobExecution deleteAttributeAsync(String entityTypeId, String attributeId) { EntityType entityType = findEntityType(entityTypeId); Attribute attribute = entityType.getOwnAttributeById(attributeId); entityType.removeAttribute(attribute); return metadataApiJobService.scheduleUpdate(entityType); } MetadataApiServiceImpl(
      MetaDataService metadataService,
      QueryMapper queryMapperV3,
      SortMapper sortMapper,
      MetadataApiJobService metadataApiJobService); }
MetadataApiServiceImpl implements MetadataApiService { @Override public MetadataUpsertJobExecution deleteAttributeAsync(String entityTypeId, String attributeId) { EntityType entityType = findEntityType(entityTypeId); Attribute attribute = entityType.getOwnAttributeById(attributeId); entityType.removeAttribute(attribute); return metadataApiJobService.scheduleUpdate(entityType); } MetadataApiServiceImpl(
      MetaDataService metadataService,
      QueryMapper queryMapperV3,
      SortMapper sortMapper,
      MetadataApiJobService metadataApiJobService); EntityTypes findEntityTypes(
      @Nullable @CheckForNull Query query, Sort sort, int size, int number); @Override EntityType findEntityType(String identifier); @Override Attributes findAttributes(
      String entityTypeId, @Nullable @CheckForNull Query query, Sort sort, int size, int number); @Override Attribute findAttribute(String entityTypeId, String attributeId); @Override MetadataUpsertJobExecution deleteAttributeAsync(String entityTypeId, String attributeId); @Override MetadataUpsertJobExecution deleteAttributesAsync(String entityTypeId, Query query); @Override void createEntityType(EntityType entityType); @Override MetadataUpsertJobExecution updateEntityTypeAsync(EntityType entityType); @Override MetadataDeleteJobExecution deleteEntityTypeAsync(String entityTypeId); @Override MetadataDeleteJobExecution deleteEntityTypesAsync(Query query); }
MetadataApiServiceImpl implements MetadataApiService { @Override public MetadataUpsertJobExecution deleteAttributeAsync(String entityTypeId, String attributeId) { EntityType entityType = findEntityType(entityTypeId); Attribute attribute = entityType.getOwnAttributeById(attributeId); entityType.removeAttribute(attribute); return metadataApiJobService.scheduleUpdate(entityType); } MetadataApiServiceImpl(
      MetaDataService metadataService,
      QueryMapper queryMapperV3,
      SortMapper sortMapper,
      MetadataApiJobService metadataApiJobService); EntityTypes findEntityTypes(
      @Nullable @CheckForNull Query query, Sort sort, int size, int number); @Override EntityType findEntityType(String identifier); @Override Attributes findAttributes(
      String entityTypeId, @Nullable @CheckForNull Query query, Sort sort, int size, int number); @Override Attribute findAttribute(String entityTypeId, String attributeId); @Override MetadataUpsertJobExecution deleteAttributeAsync(String entityTypeId, String attributeId); @Override MetadataUpsertJobExecution deleteAttributesAsync(String entityTypeId, Query query); @Override void createEntityType(EntityType entityType); @Override MetadataUpsertJobExecution updateEntityTypeAsync(EntityType entityType); @Override MetadataDeleteJobExecution deleteEntityTypeAsync(String entityTypeId); @Override MetadataDeleteJobExecution deleteEntityTypesAsync(Query query);  }