@Test public void successDetectSyntaxCall() { when(mockComprehendClient.detectSyntax(any())).thenReturn(TestConstants.getDetectSyntaxResult()); 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) { DetectSyntaxRequest request = new DetectSyntaxRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSyntaxResult detectSyntaxResult = comprehendClient.detectSyntax(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSyntaxResult), flattenSyntaxList(detectSyntaxResult.getSyntaxTokens())); }
DetectSyntax implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectSyntaxRequest request = new DetectSyntaxRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSyntaxResult detectSyntaxResult = comprehendClient.detectSyntax(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSyntaxResult), flattenSyntaxList(detectSyntaxResult.getSyntaxTokens())); } }
DetectSyntax implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectSyntaxRequest request = new DetectSyntaxRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSyntaxResult detectSyntaxResult = comprehendClient.detectSyntax(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSyntaxResult), flattenSyntaxList(detectSyntaxResult.getSyntaxTokens())); }  }
DetectSyntax implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectSyntaxRequest request = new DetectSyntaxRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSyntaxResult detectSyntaxResult = comprehendClient.detectSyntax(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSyntaxResult), flattenSyntaxList(detectSyntaxResult.getSyntaxTokens())); }  @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 SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectSyntaxRequest request = new DetectSyntaxRequest().withText(content) .withLanguageCode(languageCode.toString()); DetectSyntaxResult detectSyntaxResult = comprehendClient.detectSyntax(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectSyntaxResult), flattenSyntaxList(detectSyntaxResult.getSyntaxTokens())); }  @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);  }