@Test public void successBatchDetectSentimentCall() { when(mockComprehendClient.batchDetectSentiment(any(BatchDetectSentimentRequest.class))) .thenReturn(mockBatchDetectSentimentResult); BatchResponse result = test.sendBatchRequest( TestConstants.FIELD_LOCATOR_LIST, TestConstants.CONTENT_LIST, TestConstants.LANGUAGE_CODE, mockComprehendClient); assertEquals(TestConstants.FIELD_LOCATOR_LIST, result.getLocatorList()); }
@Override public BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList, @NonNull final List<String> contentList, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { BatchDetectSentimentRequest request = new BatchDetectSentimentRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSentimentResult batchDetectSentimentResult = comprehendClient.batchDetectSentiment(request); return new BatchResponse<>( fieldLocatorList, batchDetectSentimentResult.getResultList(), batchDetectSentimentResult.getErrorList(), null); }
DetectSentiment implements ComprehendOperation { @Override public BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList, @NonNull final List<String> contentList, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { BatchDetectSentimentRequest request = new BatchDetectSentimentRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSentimentResult batchDetectSentimentResult = comprehendClient.batchDetectSentiment(request); return new BatchResponse<>( fieldLocatorList, batchDetectSentimentResult.getResultList(), batchDetectSentimentResult.getErrorList(), null); } }
DetectSentiment implements ComprehendOperation { @Override public BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList, @NonNull final List<String> contentList, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { BatchDetectSentimentRequest request = new BatchDetectSentimentRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSentimentResult batchDetectSentimentResult = comprehendClient.batchDetectSentiment(request); return new BatchResponse<>( fieldLocatorList, batchDetectSentimentResult.getResultList(), batchDetectSentimentResult.getErrorList(), null); }  }
DetectSentiment implements ComprehendOperation { @Override public BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList, @NonNull final List<String> contentList, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { BatchDetectSentimentRequest request = new BatchDetectSentimentRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSentimentResult batchDetectSentimentResult = comprehendClient.batchDetectSentiment(request); return new BatchResponse<>( fieldLocatorList, batchDetectSentimentResult.getResultList(), batchDetectSentimentResult.getErrorList(), 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 BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList, @NonNull final List<String> contentList, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { BatchDetectSentimentRequest request = new BatchDetectSentimentRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSentimentResult batchDetectSentimentResult = comprehendClient.batchDetectSentiment(request); return new BatchResponse<>( fieldLocatorList, batchDetectSentimentResult.getResultList(), batchDetectSentimentResult.getErrorList(), 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);  }