use of com.google.cloud.datalabeling.v1beta1.ListAnnotationSpecSetsRequest in project java-datalabeling by googleapis.
the class DataLabelingServiceClientTest method listAnnotationSpecSetsTest2.
@Test
public void listAnnotationSpecSetsTest2() throws Exception {
AnnotationSpecSet responsesElement = AnnotationSpecSet.newBuilder().build();
ListAnnotationSpecSetsResponse expectedResponse = ListAnnotationSpecSetsResponse.newBuilder().setNextPageToken("").addAllAnnotationSpecSets(Arrays.asList(responsesElement)).build();
mockDataLabelingService.addResponse(expectedResponse);
String parent = "parent-995424086";
String filter = "filter-1274492040";
ListAnnotationSpecSetsPagedResponse pagedListResponse = client.listAnnotationSpecSets(parent, filter);
List<AnnotationSpecSet> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAnnotationSpecSetsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDataLabelingService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListAnnotationSpecSetsRequest actualRequest = ((ListAnnotationSpecSetsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertEquals(filter, actualRequest.getFilter());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations