@Test public void successDetectSentimentCall() { when(mockComprehendClient.detectSentiment(any())).thenReturn(TestConstants.getDetectSentimentResult()); SingularResponse result = test.sendSingularRequest(TestConstants.FIELD_NAME, TestConstants.CUSTOMER_INGESTION_PAYLOAD_TEXT, TestConstants.LANGUAGE_CODE, mockComprehendClient); assertEquals(TestConstants.FIELD_NAME, result.getFieldNameAndOperation()); }
@Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectSentimentRequest request = new DetectSentimentRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSentimentResult detectSentimentResult = comprehendClient.detectSentiment(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSentimentResult), null); }
DetectSentiment implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectSentimentRequest request = new DetectSentimentRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSentimentResult detectSentimentResult = comprehendClient.detectSentiment(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSentimentResult), null); } }
DetectSentiment implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectSentimentRequest request = new DetectSentimentRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSentimentResult detectSentimentResult = comprehendClient.detectSentiment(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSentimentResult), null); }  }
DetectSentiment implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectSentimentRequest request = new DetectSentimentRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSentimentResult detectSentimentResult = comprehendClient.detectSentiment(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSentimentResult), null); }  @Override String[] getVisualizationNameList(); @Override SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation,
                                                @NonNull final String content,
                                                @NonNull final LanguageCode languageCode,
                                                @NonNull final AmazonComprehend comprehendClient); @Override BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList,
                                          @NonNull final List<String> contentList,
                                          @NonNull final LanguageCode languageCode,
                                          @NonNull final AmazonComprehend comprehendClient); }
DetectSentiment implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectSentimentRequest request = new DetectSentimentRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSentimentResult detectSentimentResult = comprehendClient.detectSentiment(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSentimentResult), null); }  @Override String[] getVisualizationNameList(); @Override SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation,
                                                @NonNull final String content,
                                                @NonNull final LanguageCode languageCode,
                                                @NonNull final AmazonComprehend comprehendClient); @Override BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList,
                                          @NonNull final List<String> contentList,
                                          @NonNull final LanguageCode languageCode,
                                          @NonNull final AmazonComprehend comprehendClient);  }