@Test
public void injectDatasetNameBasedOnId_datasetClientError() {

    // given
    PersistentPreparation input = new PersistentPreparation();
    String dataSetId = "1234";
    input.setDataSetId(dataSetId);
    when(security.getTenantId()).thenReturn("tenant id");
    Dataset datasetMetadata = new Dataset();
    String datasetLabel = "dataset label";
    datasetMetadata.setLabel(datasetLabel);
    when(dataCatalogClient.getMetadata(dataSetId)).thenThrow(new TDPException());
    // when
    PersistentPreparation result = dataSetNameInjection.injectDatasetNameBasedOnId(input);
    // then
    assertNull(result.getDataSetName()); // dataset name has not changed in DTO
    verify(security).getTenantId();
    verifyNoMoreInteractions(security);
    verify(securityProxy).asTechnicalUserForDataSet();
    verify(securityProxy).releaseIdentity();
    verifyNoMoreInteractions(securityProxy);
    verify(dataCatalogClient).getMetadata(dataSetId);
    verifyNoMoreInteractions(dataCatalogClient);
    verifyZeroInteractions(preparationRepository);
}