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