use of com.google.cloud.dialogflow.cx.v3beta1.ExperimentsClient.ListExperimentsPagedResponse in project java-dialogflow-cx by googleapis.
the class ExperimentsClientTest method listExperimentsTest.
@Test
public void listExperimentsTest() throws Exception {
Experiment responsesElement = Experiment.newBuilder().build();
ListExperimentsResponse expectedResponse = ListExperimentsResponse.newBuilder().setNextPageToken("").addAllExperiments(Arrays.asList(responsesElement)).build();
mockExperiments.addResponse(expectedResponse);
EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
ListExperimentsPagedResponse pagedListResponse = client.listExperiments(parent);
List<Experiment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExperimentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockExperiments.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExperimentsRequest actualRequest = ((ListExperimentsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ExperimentsClient.ListExperimentsPagedResponse in project java-dialogflow-cx by googleapis.
the class ExperimentsClientTest method listExperimentsTest2.
@Test
public void listExperimentsTest2() throws Exception {
Experiment responsesElement = Experiment.newBuilder().build();
ListExperimentsResponse expectedResponse = ListExperimentsResponse.newBuilder().setNextPageToken("").addAllExperiments(Arrays.asList(responsesElement)).build();
mockExperiments.addResponse(expectedResponse);
String parent = "parent-995424086";
ListExperimentsPagedResponse pagedListResponse = client.listExperiments(parent);
List<Experiment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExperimentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockExperiments.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExperimentsRequest actualRequest = ((ListExperimentsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ExperimentsClient.ListExperimentsPagedResponse in project java-dialogflow-cx by googleapis.
the class ExperimentsClientTest method listExperimentsTest2.
@Test
public void listExperimentsTest2() throws Exception {
Experiment responsesElement = Experiment.newBuilder().build();
ListExperimentsResponse expectedResponse = ListExperimentsResponse.newBuilder().setNextPageToken("").addAllExperiments(Arrays.asList(responsesElement)).build();
mockExperiments.addResponse(expectedResponse);
String parent = "parent-995424086";
ListExperimentsPagedResponse pagedListResponse = client.listExperiments(parent);
List<Experiment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExperimentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockExperiments.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExperimentsRequest actualRequest = ((ListExperimentsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ExperimentsClient.ListExperimentsPagedResponse in project java-dialogflow-cx by googleapis.
the class ExperimentsClientTest method listExperimentsTest.
@Test
public void listExperimentsTest() throws Exception {
Experiment responsesElement = Experiment.newBuilder().build();
ListExperimentsResponse expectedResponse = ListExperimentsResponse.newBuilder().setNextPageToken("").addAllExperiments(Arrays.asList(responsesElement)).build();
mockExperiments.addResponse(expectedResponse);
EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
ListExperimentsPagedResponse pagedListResponse = client.listExperiments(parent);
List<Experiment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExperimentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockExperiments.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExperimentsRequest actualRequest = ((ListExperimentsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations