use of com.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest in project spring-cloud-gcp by GoogleCloudPlatform.
the class CloudVisionTemplateTests method testAddInputConfig_extractText.
@Test
public void testAddInputConfig_extractText() throws IOException {
when(this.imageAnnotatorClient.batchAnnotateFiles(any(BatchAnnotateFilesRequest.class))).thenReturn(DEFAULT_FILES_API_RESPONSE);
this.cloudVisionTemplate.extractTextFromPdf(FAKE_PDF);
BatchAnnotateFilesRequest expectedRequest = BatchAnnotateFilesRequest.newBuilder().addRequests(AnnotateFileRequest.newBuilder().addFeatures(Feature.newBuilder().setType(Type.DOCUMENT_TEXT_DETECTION)).setInputConfig(InputConfig.newBuilder().setMimeType("application/pdf").setContent(ByteString.readFrom(FAKE_PDF.getInputStream())).build()).build()).build();
verify(this.imageAnnotatorClient, times(1)).batchAnnotateFiles(expectedRequest);
}
Aggregations