@Test public void successSingularOperationCall() { test = new SingularOperationCallable(TestConstants.FIELD_NAME, ComprehendOperationEnum.DetectSentiment, TestConstants.LANGUAGE_CODE, TestConstants.CUSTOMER_INGESTION_PAYLOAD_TEXT, mockComprehendClient); when(mockComprehendClient.detectSentiment(any())).thenReturn(TestConstants.getDetectSentimentResult()); assertEquals(TestConstants.FIELD_NAME, test.call().getFieldNameAndOperation()); }
@Override public SingularResponse call() { try { return comprehendOperation.getComprehendOperation() .sendSingularRequest(fieldNameAndOperation, content, languageCode, comprehendClient); } catch (AmazonServiceException e) { ServiceExceptionMessage serviceException = ServiceExceptionMessage.builder() .statusCode(e.getStatusCode()) .errorCode(e.getErrorCode()) .requestId(e.getRequestId()) .errorMessage(e.getErrorMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(serviceException), null); } catch (AmazonClientException e) { ClientExceptionMessage clientException = ClientExceptionMessage.builder() .errorCode(Constants.CLIENT_EXCEPTION_ERROR_CODE) .errorMessage(e.getMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(clientException), null); } }
SingularOperationCallable implements Callable<SingularResponse> { @Override public SingularResponse call() { try { return comprehendOperation.getComprehendOperation() .sendSingularRequest(fieldNameAndOperation, content, languageCode, comprehendClient); } catch (AmazonServiceException e) { ServiceExceptionMessage serviceException = ServiceExceptionMessage.builder() .statusCode(e.getStatusCode()) .errorCode(e.getErrorCode()) .requestId(e.getRequestId()) .errorMessage(e.getErrorMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(serviceException), null); } catch (AmazonClientException e) { ClientExceptionMessage clientException = ClientExceptionMessage.builder() .errorCode(Constants.CLIENT_EXCEPTION_ERROR_CODE) .errorMessage(e.getMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(clientException), null); } } }
SingularOperationCallable implements Callable<SingularResponse> { @Override public SingularResponse call() { try { return comprehendOperation.getComprehendOperation() .sendSingularRequest(fieldNameAndOperation, content, languageCode, comprehendClient); } catch (AmazonServiceException e) { ServiceExceptionMessage serviceException = ServiceExceptionMessage.builder() .statusCode(e.getStatusCode()) .errorCode(e.getErrorCode()) .requestId(e.getRequestId()) .errorMessage(e.getErrorMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(serviceException), null); } catch (AmazonClientException e) { ClientExceptionMessage clientException = ClientExceptionMessage.builder() .errorCode(Constants.CLIENT_EXCEPTION_ERROR_CODE) .errorMessage(e.getMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(clientException), null); } }  }
SingularOperationCallable implements Callable<SingularResponse> { @Override public SingularResponse call() { try { return comprehendOperation.getComprehendOperation() .sendSingularRequest(fieldNameAndOperation, content, languageCode, comprehendClient); } catch (AmazonServiceException e) { ServiceExceptionMessage serviceException = ServiceExceptionMessage.builder() .statusCode(e.getStatusCode()) .errorCode(e.getErrorCode()) .requestId(e.getRequestId()) .errorMessage(e.getErrorMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(serviceException), null); } catch (AmazonClientException e) { ClientExceptionMessage clientException = ClientExceptionMessage.builder() .errorCode(Constants.CLIENT_EXCEPTION_ERROR_CODE) .errorMessage(e.getMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(clientException), null); } }  @Override SingularResponse call(); }
SingularOperationCallable implements Callable<SingularResponse> { @Override public SingularResponse call() { try { return comprehendOperation.getComprehendOperation() .sendSingularRequest(fieldNameAndOperation, content, languageCode, comprehendClient); } catch (AmazonServiceException e) { ServiceExceptionMessage serviceException = ServiceExceptionMessage.builder() .statusCode(e.getStatusCode()) .errorCode(e.getErrorCode()) .requestId(e.getRequestId()) .errorMessage(e.getErrorMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(serviceException), null); } catch (AmazonClientException e) { ClientExceptionMessage clientException = ClientExceptionMessage.builder() .errorCode(Constants.CLIENT_EXCEPTION_ERROR_CODE) .errorMessage(e.getMessage()) .build(); return new SingularResponse(String.format("%s_Error", fieldNameAndOperation), new JSONObject(clientException), null); } }  @Override SingularResponse call();  }