use of com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse in project java-dialogflow by googleapis.
the class SessionEntityTypesClientTest method listSessionEntityTypesTest.
@Test
public void listSessionEntityTypesTest() throws Exception {
SessionEntityType responsesElement = SessionEntityType.newBuilder().build();
ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder().setNextPageToken("").addAllSessionEntityTypes(Arrays.asList(responsesElement)).build();
mockSessionEntityTypes.addResponse(expectedResponse);
SessionName parent = SessionName.ofProjectSessionName("[PROJECT]", "[SESSION]");
ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent);
List<SessionEntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockSessionEntityTypes.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListSessionEntityTypesRequest actualRequest = ((ListSessionEntityTypesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse in project java-dialogflow-cx by googleapis.
the class SessionEntityTypesClientTest method listSessionEntityTypesTest.
@Test
public void listSessionEntityTypesTest() throws Exception {
SessionEntityType responsesElement = SessionEntityType.newBuilder().build();
ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder().setNextPageToken("").addAllSessionEntityTypes(Arrays.asList(responsesElement)).build();
mockSessionEntityTypes.addResponse(expectedResponse);
SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent);
List<SessionEntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockSessionEntityTypes.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListSessionEntityTypesRequest actualRequest = ((ListSessionEntityTypesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse in project java-dialogflow-cx by googleapis.
the class SessionEntityTypesClientTest method listSessionEntityTypesTest2.
@Test
public void listSessionEntityTypesTest2() throws Exception {
SessionEntityType responsesElement = SessionEntityType.newBuilder().build();
ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder().setNextPageToken("").addAllSessionEntityTypes(Arrays.asList(responsesElement)).build();
mockSessionEntityTypes.addResponse(expectedResponse);
String parent = "parent-995424086";
ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent);
List<SessionEntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockSessionEntityTypes.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListSessionEntityTypesRequest actualRequest = ((ListSessionEntityTypesRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations