use of com.google.cloud.dialogflow.cx.v3beta1.TestCasesClient.ListTestCasesPagedResponse in project java-dialogflow-cx by googleapis.
the class TestCasesClientTest method listTestCasesTest2.
@Test
public void listTestCasesTest2() throws Exception {
TestCase responsesElement = TestCase.newBuilder().build();
ListTestCasesResponse expectedResponse = ListTestCasesResponse.newBuilder().setNextPageToken("").addAllTestCases(Arrays.asList(responsesElement)).build();
mockTestCases.addResponse(expectedResponse);
String parent = "parent-995424086";
ListTestCasesPagedResponse pagedListResponse = client.listTestCases(parent);
List<TestCase> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTestCasesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockTestCases.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTestCasesRequest actualRequest = ((ListTestCasesRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.TestCasesClient.ListTestCasesPagedResponse in project java-dialogflow-cx by googleapis.
the class TestCasesClientTest method listTestCasesTest.
@Test
public void listTestCasesTest() throws Exception {
TestCase responsesElement = TestCase.newBuilder().build();
ListTestCasesResponse expectedResponse = ListTestCasesResponse.newBuilder().setNextPageToken("").addAllTestCases(Arrays.asList(responsesElement)).build();
mockTestCases.addResponse(expectedResponse);
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
ListTestCasesPagedResponse pagedListResponse = client.listTestCases(parent);
List<TestCase> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTestCasesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockTestCases.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTestCasesRequest actualRequest = ((ListTestCasesRequest) 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.TestCasesClient.ListTestCasesPagedResponse in project java-dialogflow-cx by googleapis.
the class TestCasesClientTest method listTestCasesTest2.
@Test
public void listTestCasesTest2() throws Exception {
TestCase responsesElement = TestCase.newBuilder().build();
ListTestCasesResponse expectedResponse = ListTestCasesResponse.newBuilder().setNextPageToken("").addAllTestCases(Arrays.asList(responsesElement)).build();
mockTestCases.addResponse(expectedResponse);
String parent = "parent-995424086";
ListTestCasesPagedResponse pagedListResponse = client.listTestCases(parent);
List<TestCase> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTestCasesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockTestCases.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTestCasesRequest actualRequest = ((ListTestCasesRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.TestCasesClient.ListTestCasesPagedResponse in project java-dialogflow-cx by googleapis.
the class TestCasesClientTest method listTestCasesTest.
@Test
public void listTestCasesTest() throws Exception {
TestCase responsesElement = TestCase.newBuilder().build();
ListTestCasesResponse expectedResponse = ListTestCasesResponse.newBuilder().setNextPageToken("").addAllTestCases(Arrays.asList(responsesElement)).build();
mockTestCases.addResponse(expectedResponse);
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
ListTestCasesPagedResponse pagedListResponse = client.listTestCases(parent);
List<TestCase> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTestCasesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockTestCases.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTestCasesRequest actualRequest = ((ListTestCasesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations