Search in sources :

Example 1 with SearchExampleComparisonsPagedResponse

use of com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.SearchExampleComparisonsPagedResponse in project java-datalabeling by googleapis.

the class DataLabelingServiceClientTest method searchExampleComparisonsTest.

@Test
public void searchExampleComparisonsTest() throws Exception {
    SearchExampleComparisonsResponse.ExampleComparison responsesElement = SearchExampleComparisonsResponse.ExampleComparison.newBuilder().build();
    SearchExampleComparisonsResponse expectedResponse = SearchExampleComparisonsResponse.newBuilder().setNextPageToken("").addAllExampleComparisons(Arrays.asList(responsesElement)).build();
    mockDataLabelingService.addResponse(expectedResponse);
    EvaluationName parent = EvaluationName.of("[PROJECT]", "[DATASET]", "[EVALUATION]");
    SearchExampleComparisonsPagedResponse pagedListResponse = client.searchExampleComparisons(parent);
    List<SearchExampleComparisonsResponse.ExampleComparison> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getExampleComparisonsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDataLabelingService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    SearchExampleComparisonsRequest actualRequest = ((SearchExampleComparisonsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) SearchExampleComparisonsPagedResponse(com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.SearchExampleComparisonsPagedResponse) Test(org.junit.Test)

Example 2 with SearchExampleComparisonsPagedResponse

use of com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.SearchExampleComparisonsPagedResponse in project java-datalabeling by googleapis.

the class DataLabelingServiceClientTest method searchExampleComparisonsTest2.

@Test
public void searchExampleComparisonsTest2() throws Exception {
    SearchExampleComparisonsResponse.ExampleComparison responsesElement = SearchExampleComparisonsResponse.ExampleComparison.newBuilder().build();
    SearchExampleComparisonsResponse expectedResponse = SearchExampleComparisonsResponse.newBuilder().setNextPageToken("").addAllExampleComparisons(Arrays.asList(responsesElement)).build();
    mockDataLabelingService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    SearchExampleComparisonsPagedResponse pagedListResponse = client.searchExampleComparisons(parent);
    List<SearchExampleComparisonsResponse.ExampleComparison> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getExampleComparisonsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDataLabelingService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    SearchExampleComparisonsRequest actualRequest = ((SearchExampleComparisonsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) SearchExampleComparisonsPagedResponse(com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.SearchExampleComparisonsPagedResponse) Test(org.junit.Test)

Aggregations

SearchExampleComparisonsPagedResponse (com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClient.SearchExampleComparisonsPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2