@Test public void successDetectEntitiesCall() { when(mockComprehendClient.detectEntities(any())).thenReturn(TestConstants.getDetectEntitiesResult()); 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) { DetectEntitiesRequest request = new DetectEntitiesRequest().withText(content).withLanguageCode(languageCode.toString()); DetectEntitiesResult detectEntitiesResult = comprehendClient.detectEntities(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectEntitiesResult), flattenEntityList(detectEntitiesResult.getEntities())); }
DetectEntities implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectEntitiesRequest request = new DetectEntitiesRequest().withText(content).withLanguageCode(languageCode.toString()); DetectEntitiesResult detectEntitiesResult = comprehendClient.detectEntities(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectEntitiesResult), flattenEntityList(detectEntitiesResult.getEntities())); } }
DetectEntities implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectEntitiesRequest request = new DetectEntitiesRequest().withText(content).withLanguageCode(languageCode.toString()); DetectEntitiesResult detectEntitiesResult = comprehendClient.detectEntities(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectEntitiesResult), flattenEntityList(detectEntitiesResult.getEntities())); }  }
DetectEntities implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectEntitiesRequest request = new DetectEntitiesRequest().withText(content).withLanguageCode(languageCode.toString()); DetectEntitiesResult detectEntitiesResult = comprehendClient.detectEntities(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectEntitiesResult), flattenEntityList(detectEntitiesResult.getEntities())); }  @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); }
DetectEntities implements ComprehendOperation { @Override public SingularResponse sendSingularRequest(@NonNull final String fieldNameAndOperation, @NonNull final String content, @NonNull final LanguageCode languageCode, @NonNull final AmazonComprehend comprehendClient) { DetectEntitiesRequest request = new DetectEntitiesRequest().withText(content).withLanguageCode(languageCode.toString()); DetectEntitiesResult detectEntitiesResult = comprehendClient.detectEntities(request); return new SingularResponse(fieldNameAndOperation, new JSONObject(detectEntitiesResult), flattenEntityList(detectEntitiesResult.getEntities())); }  @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);  }