use of com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse in project java-dialogflow by googleapis.
the class ConversationsClientTest method listConversationsTest2.
@Test
public void listConversationsTest2() throws Exception {
Conversation responsesElement = Conversation.newBuilder().build();
ListConversationsResponse expectedResponse = ListConversationsResponse.newBuilder().setNextPageToken("").addAllConversations(Arrays.asList(responsesElement)).build();
mockConversations.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
ListConversationsPagedResponse pagedListResponse = client.listConversations(parent);
List<Conversation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getConversationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConversations.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListConversationsRequest actualRequest = ((ListConversationsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse in project java-dialogflow by googleapis.
the class ConversationsClientTest method listConversationsTest.
@Test
public void listConversationsTest() throws Exception {
Conversation responsesElement = Conversation.newBuilder().build();
ListConversationsResponse expectedResponse = ListConversationsResponse.newBuilder().setNextPageToken("").addAllConversations(Arrays.asList(responsesElement)).build();
mockConversations.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListConversationsPagedResponse pagedListResponse = client.listConversations(parent);
List<Conversation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getConversationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConversations.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListConversationsRequest actualRequest = ((ListConversationsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse in project java-dialogflow by googleapis.
the class ConversationsClientTest method listConversationsTest3.
@Test
public void listConversationsTest3() throws Exception {
Conversation responsesElement = Conversation.newBuilder().build();
ListConversationsResponse expectedResponse = ListConversationsResponse.newBuilder().setNextPageToken("").addAllConversations(Arrays.asList(responsesElement)).build();
mockConversations.addResponse(expectedResponse);
String parent = "parent-995424086";
ListConversationsPagedResponse pagedListResponse = client.listConversations(parent);
List<Conversation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getConversationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConversations.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListConversationsRequest actualRequest = ((ListConversationsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse in project java-dialogflow by googleapis.
the class ConversationsClientTest method listConversationsTest.
@Test
public void listConversationsTest() throws Exception {
Conversation responsesElement = Conversation.newBuilder().build();
ListConversationsResponse expectedResponse = ListConversationsResponse.newBuilder().setNextPageToken("").addAllConversations(Arrays.asList(responsesElement)).build();
mockConversations.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListConversationsPagedResponse pagedListResponse = client.listConversations(parent);
List<Conversation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getConversationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConversations.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListConversationsRequest actualRequest = ((ListConversationsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse in project java-dialogflow by googleapis.
the class ConversationsClientTest method listConversationsTest2.
@Test
public void listConversationsTest2() throws Exception {
Conversation responsesElement = Conversation.newBuilder().build();
ListConversationsResponse expectedResponse = ListConversationsResponse.newBuilder().setNextPageToken("").addAllConversations(Arrays.asList(responsesElement)).build();
mockConversations.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
ListConversationsPagedResponse pagedListResponse = client.listConversations(parent);
List<Conversation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getConversationsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConversations.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListConversationsRequest actualRequest = ((ListConversationsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations