@Test void getSyncOperationStatusFailure() { when(webApplicationExceptionMessageExtractor.getErrorMessage(any())).thenReturn("custom error"); when(userV1Endpoint.getSyncOperationStatus(OPERATION)).thenThrow(new WebApplicationException("network error")); assertThatThrownBy(() -> underTest.getSyncOperationStatus(ENVCRN, OPERATION)).isInstanceOf(FreeIpaOperationFailedException.class); }
public SyncOperationStatus getSyncOperationStatus(String environmentCrn, String operationId) { try { return userV1Endpoint.getSyncOperationStatus(operationId); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to get user synchronization status from FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } }
FreeIpaService { public SyncOperationStatus getSyncOperationStatus(String environmentCrn, String operationId) { try { return userV1Endpoint.getSyncOperationStatus(operationId); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to get user synchronization status from FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } } }
FreeIpaService { public SyncOperationStatus getSyncOperationStatus(String environmentCrn, String operationId) { try { return userV1Endpoint.getSyncOperationStatus(operationId); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to get user synchronization status from FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } } FreeIpaService(FreeIpaV1Endpoint freeIpaV1Endpoint,
            UserV1Endpoint userV1Endpoint,
            WebApplicationExceptionMessageExtractor webApplicationExceptionMessageExtractor); }
FreeIpaService { public SyncOperationStatus getSyncOperationStatus(String environmentCrn, String operationId) { try { return userV1Endpoint.getSyncOperationStatus(operationId); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to get user synchronization status from FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } } FreeIpaService(FreeIpaV1Endpoint freeIpaV1Endpoint,
            UserV1Endpoint userV1Endpoint,
            WebApplicationExceptionMessageExtractor webApplicationExceptionMessageExtractor); DescribeFreeIpaResponse create(CreateFreeIpaRequest createFreeIpaRequest); Optional<DescribeFreeIpaResponse> describe(String envCrn); void delete(String environmentCrn, boolean forced); void attachChildEnvironment(AttachChildEnvironmentRequest attachChildEnvironmentRequest); void detachChildEnvironment(DetachChildEnvironmentRequest detachChildEnvironmentRequest); SyncOperationStatus getSyncOperationStatus(String environmentCrn, String operationId); HealthDetailsFreeIpaResponse getHealthDetails(String environmentCrn); }
FreeIpaService { public SyncOperationStatus getSyncOperationStatus(String environmentCrn, String operationId) { try { return userV1Endpoint.getSyncOperationStatus(operationId); } catch (WebApplicationException e) { String errorMessage = webApplicationExceptionMessageExtractor.getErrorMessage(e); LOGGER.error(String.format("Failed to get user synchronization status from FreeIpa for environment '%s' due to: '%s'", environmentCrn, errorMessage), e); throw new FreeIpaOperationFailedException(errorMessage, e); } } FreeIpaService(FreeIpaV1Endpoint freeIpaV1Endpoint,
            UserV1Endpoint userV1Endpoint,
            WebApplicationExceptionMessageExtractor webApplicationExceptionMessageExtractor); DescribeFreeIpaResponse create(CreateFreeIpaRequest createFreeIpaRequest); Optional<DescribeFreeIpaResponse> describe(String envCrn); void delete(String environmentCrn, boolean forced); void attachChildEnvironment(AttachChildEnvironmentRequest attachChildEnvironmentRequest); void detachChildEnvironment(DetachChildEnvironmentRequest detachChildEnvironmentRequest); SyncOperationStatus getSyncOperationStatus(String environmentCrn, String operationId); HealthDetailsFreeIpaResponse getHealthDetails(String environmentCrn);  }