use of com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCaseResultsPagedResponse in project java-dialogflow-cx by googleapis.
the class TestCasesClientTest method listTestCaseResultsTest.
@Test
public void listTestCaseResultsTest() throws Exception {
TestCaseResult responsesElement = TestCaseResult.newBuilder().build();
ListTestCaseResultsResponse expectedResponse = ListTestCaseResultsResponse.newBuilder().setNextPageToken("").addAllTestCaseResults(Arrays.asList(responsesElement)).build();
mockTestCases.addResponse(expectedResponse);
TestCaseName parent = TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]");
ListTestCaseResultsPagedResponse pagedListResponse = client.listTestCaseResults(parent);
List<TestCaseResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTestCaseResultsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockTestCases.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTestCaseResultsRequest actualRequest = ((ListTestCaseResultsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCaseResultsPagedResponse in project java-dialogflow-cx by googleapis.
the class TestCasesClientTest method listTestCaseResultsTest2.
@Test
public void listTestCaseResultsTest2() throws Exception {
TestCaseResult responsesElement = TestCaseResult.newBuilder().build();
ListTestCaseResultsResponse expectedResponse = ListTestCaseResultsResponse.newBuilder().setNextPageToken("").addAllTestCaseResults(Arrays.asList(responsesElement)).build();
mockTestCases.addResponse(expectedResponse);
String parent = "parent-995424086";
ListTestCaseResultsPagedResponse pagedListResponse = client.listTestCaseResults(parent);
List<TestCaseResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTestCaseResultsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockTestCases.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTestCaseResultsRequest actualRequest = ((ListTestCaseResultsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCaseResultsPagedResponse in project java-dialogflow-cx by googleapis.
the class TestCasesClientTest method listTestCaseResultsTest.
@Test
public void listTestCaseResultsTest() throws Exception {
TestCaseResult responsesElement = TestCaseResult.newBuilder().build();
ListTestCaseResultsResponse expectedResponse = ListTestCaseResultsResponse.newBuilder().setNextPageToken("").addAllTestCaseResults(Arrays.asList(responsesElement)).build();
mockTestCases.addResponse(expectedResponse);
TestCaseName parent = TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]");
ListTestCaseResultsPagedResponse pagedListResponse = client.listTestCaseResults(parent);
List<TestCaseResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTestCaseResultsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockTestCases.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTestCaseResultsRequest actualRequest = ((ListTestCaseResultsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCaseResultsPagedResponse in project java-dialogflow-cx by googleapis.
the class TestCasesClientTest method listTestCaseResultsTest2.
@Test
public void listTestCaseResultsTest2() throws Exception {
TestCaseResult responsesElement = TestCaseResult.newBuilder().build();
ListTestCaseResultsResponse expectedResponse = ListTestCaseResultsResponse.newBuilder().setNextPageToken("").addAllTestCaseResults(Arrays.asList(responsesElement)).build();
mockTestCases.addResponse(expectedResponse);
String parent = "parent-995424086";
ListTestCaseResultsPagedResponse pagedListResponse = client.listTestCaseResults(parent);
List<TestCaseResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTestCaseResultsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockTestCases.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTestCaseResultsRequest actualRequest = ((ListTestCaseResultsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations