use of com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse in project java-automl by googleapis.
the class AutoMlClientTest method listModelEvaluationsTest2.
@Test
public void listModelEvaluationsTest2() throws Exception {
ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluation(Arrays.asList(responsesElement)).build();
mockAutoMl.addResponse(expectedResponse);
String parent = "parent-995424086";
ListModelEvaluationsPagedResponse pagedListResponse = client.listModelEvaluations(parent);
List<ModelEvaluation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getModelEvaluationList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAutoMl.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListModelEvaluationsRequest actualRequest = ((ListModelEvaluationsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse in project java-automl by googleapis.
the class AutoMlClientTest method listModelEvaluationsTest2.
@Test
public void listModelEvaluationsTest2() throws Exception {
ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluation(Arrays.asList(responsesElement)).build();
mockAutoMl.addResponse(expectedResponse);
String parent = "parent-995424086";
String filter = "filter-1274492040";
ListModelEvaluationsPagedResponse pagedListResponse = client.listModelEvaluations(parent, filter);
List<ModelEvaluation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getModelEvaluationList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAutoMl.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListModelEvaluationsRequest actualRequest = ((ListModelEvaluationsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertEquals(filter, actualRequest.getFilter());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse in project java-automl by googleapis.
the class AutoMlClientTest method listModelEvaluationsTest.
@Test
public void listModelEvaluationsTest() throws Exception {
ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluation(Arrays.asList(responsesElement)).build();
mockAutoMl.addResponse(expectedResponse);
ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
String filter = "filter-1274492040";
ListModelEvaluationsPagedResponse pagedListResponse = client.listModelEvaluations(parent, filter);
List<ModelEvaluation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getModelEvaluationList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAutoMl.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListModelEvaluationsRequest actualRequest = ((ListModelEvaluationsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(filter, actualRequest.getFilter());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.automl.v1beta1.AutoMlClient.ListModelEvaluationsPagedResponse in project java-automl by googleapis.
the class AutoMlClientTest method listModelEvaluationsTest.
@Test
public void listModelEvaluationsTest() throws Exception {
ModelEvaluation responsesElement = ModelEvaluation.newBuilder().build();
ListModelEvaluationsResponse expectedResponse = ListModelEvaluationsResponse.newBuilder().setNextPageToken("").addAllModelEvaluation(Arrays.asList(responsesElement)).build();
mockAutoMl.addResponse(expectedResponse);
ModelName parent = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
ListModelEvaluationsPagedResponse pagedListResponse = client.listModelEvaluations(parent);
List<ModelEvaluation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getModelEvaluationList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAutoMl.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListModelEvaluationsRequest actualRequest = ((ListModelEvaluationsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations