@Test public void successBatchDetectSyntaxCall() { when(mockComprehendClient.batchDetectSyntax(any(BatchDetectSyntaxRequest.class))) .thenReturn(mockBatchDetectSyntaxResult); 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) { BatchDetectSyntaxRequest request = new BatchDetectSyntaxRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSyntaxResult batchDetectSyntaxResult = comprehendClient.batchDetectSyntax(request); List<JSONObject> flattenedSyntaxList = new ArrayList<>(); for (BatchDetectSyntaxItemResult resultItem : batchDetectSyntaxResult.getResultList()) { flattenedSyntaxList.add(flattenSyntaxList(resultItem.getSyntaxTokens())); } return new BatchResponse<>( fieldLocatorList, batchDetectSyntaxResult.getResultList(), batchDetectSyntaxResult.getErrorList(), flattenedSyntaxList); }
DetectSyntax implements ComprehendOperation { @Override public BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList, @NonNull final List<String> contentList, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { BatchDetectSyntaxRequest request = new BatchDetectSyntaxRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSyntaxResult batchDetectSyntaxResult = comprehendClient.batchDetectSyntax(request); List<JSONObject> flattenedSyntaxList = new ArrayList<>(); for (BatchDetectSyntaxItemResult resultItem : batchDetectSyntaxResult.getResultList()) { flattenedSyntaxList.add(flattenSyntaxList(resultItem.getSyntaxTokens())); } return new BatchResponse<>( fieldLocatorList, batchDetectSyntaxResult.getResultList(), batchDetectSyntaxResult.getErrorList(), flattenedSyntaxList); } }
DetectSyntax implements ComprehendOperation { @Override public BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList, @NonNull final List<String> contentList, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { BatchDetectSyntaxRequest request = new BatchDetectSyntaxRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSyntaxResult batchDetectSyntaxResult = comprehendClient.batchDetectSyntax(request); List<JSONObject> flattenedSyntaxList = new ArrayList<>(); for (BatchDetectSyntaxItemResult resultItem : batchDetectSyntaxResult.getResultList()) { flattenedSyntaxList.add(flattenSyntaxList(resultItem.getSyntaxTokens())); } return new BatchResponse<>( fieldLocatorList, batchDetectSyntaxResult.getResultList(), batchDetectSyntaxResult.getErrorList(), flattenedSyntaxList); }  }
DetectSyntax implements ComprehendOperation { @Override public BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList, @NonNull final List<String> contentList, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { BatchDetectSyntaxRequest request = new BatchDetectSyntaxRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSyntaxResult batchDetectSyntaxResult = comprehendClient.batchDetectSyntax(request); List<JSONObject> flattenedSyntaxList = new ArrayList<>(); for (BatchDetectSyntaxItemResult resultItem : batchDetectSyntaxResult.getResultList()) { flattenedSyntaxList.add(flattenSyntaxList(resultItem.getSyntaxTokens())); } return new BatchResponse<>( fieldLocatorList, batchDetectSyntaxResult.getResultList(), batchDetectSyntaxResult.getErrorList(), flattenedSyntaxList); }  @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); }
DetectSyntax implements ComprehendOperation { @Override public BatchResponse sendBatchRequest(@NonNull final List<BatchFieldLocator> fieldLocatorList, @NonNull final List<String> contentList, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { BatchDetectSyntaxRequest request = new BatchDetectSyntaxRequest().withTextList(contentList).withLanguageCode(languageCode.toString()); BatchDetectSyntaxResult batchDetectSyntaxResult = comprehendClient.batchDetectSyntax(request); List<JSONObject> flattenedSyntaxList = new ArrayList<>(); for (BatchDetectSyntaxItemResult resultItem : batchDetectSyntaxResult.getResultList()) { flattenedSyntaxList.add(flattenSyntaxList(resultItem.getSyntaxTokens())); } return new BatchResponse<>( fieldLocatorList, batchDetectSyntaxResult.getResultList(), batchDetectSyntaxResult.getErrorList(), flattenedSyntaxList); }  @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);  }