Search in sources :

Example 6 with ListConversationsPagedResponse

use of com.google.cloud.dialogflow.v2.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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListConversationsPagedResponse(com.google.cloud.dialogflow.v2.ConversationsClient.ListConversationsPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)6 Test (org.junit.Test)6 ListConversationsPagedResponse (com.google.cloud.dialogflow.v2.ConversationsClient.ListConversationsPagedResponse)3 ListConversationsPagedResponse (com.google.cloud.dialogflow.v2beta1.ConversationsClient.ListConversationsPagedResponse)3