use of com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse in project java-dialogflow-cx by googleapis.
the class PagesClientTest method listPagesTest2.
@Test
public void listPagesTest2() throws Exception {
Page responsesElement = Page.newBuilder().build();
ListPagesResponse expectedResponse = ListPagesResponse.newBuilder().setNextPageToken("").addAllPages(Arrays.asList(responsesElement)).build();
mockPages.addResponse(expectedResponse);
String parent = "parent-995424086";
ListPagesPagedResponse pagedListResponse = client.listPages(parent);
List<Page> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPages.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse in project java-dialogflow-cx by googleapis.
the class PagesClientTest method listPagesTest.
@Test
public void listPagesTest() throws Exception {
Page responsesElement = Page.newBuilder().build();
ListPagesResponse expectedResponse = ListPagesResponse.newBuilder().setNextPageToken("").addAllPages(Arrays.asList(responsesElement)).build();
mockPages.addResponse(expectedResponse);
FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
ListPagesPagedResponse pagedListResponse = client.listPages(parent);
List<Page> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPages.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListPagesRequest actualRequest = ((ListPagesRequest) 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.PagesClient.ListPagesPagedResponse in project java-dialogflow-cx by googleapis.
the class PagesClientTest method listPagesTest2.
@Test
public void listPagesTest2() throws Exception {
Page responsesElement = Page.newBuilder().build();
ListPagesResponse expectedResponse = ListPagesResponse.newBuilder().setNextPageToken("").addAllPages(Arrays.asList(responsesElement)).build();
mockPages.addResponse(expectedResponse);
String parent = "parent-995424086";
ListPagesPagedResponse pagedListResponse = client.listPages(parent);
List<Page> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPages.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse in project java-dialogflow-cx by googleapis.
the class PagesClientTest method listPagesTest.
@Test
public void listPagesTest() throws Exception {
Page responsesElement = Page.newBuilder().build();
ListPagesResponse expectedResponse = ListPagesResponse.newBuilder().setNextPageToken("").addAllPages(Arrays.asList(responsesElement)).build();
mockPages.addResponse(expectedResponse);
FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
ListPagesPagedResponse pagedListResponse = client.listPages(parent);
List<Page> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPages.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations