Search in sources :

Example 1 with BatchAnnotateImagesRequest

use of com.google.cloud.vision.v1.BatchAnnotateImagesRequest in project google-cloud-java by GoogleCloudPlatform.

the class ImageAnnotatorClientTest method batchAnnotateImagesTest.

@Test
@SuppressWarnings("all")
public void batchAnnotateImagesTest() {
    BatchAnnotateImagesResponse expectedResponse = BatchAnnotateImagesResponse.newBuilder().build();
    mockImageAnnotator.addResponse(expectedResponse);
    List<AnnotateImageRequest> requests = new ArrayList<>();
    BatchAnnotateImagesResponse actualResponse = client.batchAnnotateImages(requests);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockImageAnnotator.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    BatchAnnotateImagesRequest actualRequest = (BatchAnnotateImagesRequest) actualRequests.get(0);
    Assert.assertEquals(requests, actualRequest.getRequestsList());
}
Also used : BatchAnnotateImagesRequest(com.google.cloud.vision.v1.BatchAnnotateImagesRequest) AnnotateImageRequest(com.google.cloud.vision.v1.AnnotateImageRequest) ArrayList(java.util.ArrayList) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) BatchAnnotateImagesResponse(com.google.cloud.vision.v1.BatchAnnotateImagesResponse) Test(org.junit.Test)

Aggregations

AnnotateImageRequest (com.google.cloud.vision.v1.AnnotateImageRequest)1 BatchAnnotateImagesRequest (com.google.cloud.vision.v1.BatchAnnotateImagesRequest)1 BatchAnnotateImagesResponse (com.google.cloud.vision.v1.BatchAnnotateImagesResponse)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1