Search in sources :

Example 1 with ListTestCaseResultsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.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()));
}
Also used : ListTestCaseResultsPagedResponse(com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCaseResultsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 2 with ListTestCaseResultsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.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()));
}
Also used : ListTestCaseResultsPagedResponse(com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCaseResultsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 3 with ListTestCaseResultsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.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()));
}
Also used : ListTestCaseResultsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.TestCasesClient.ListTestCaseResultsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 4 with ListTestCaseResultsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.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()));
}
Also used : ListTestCaseResultsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.TestCasesClient.ListTestCaseResultsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 ListTestCaseResultsPagedResponse (com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCaseResultsPagedResponse)2 ListTestCaseResultsPagedResponse (com.google.cloud.dialogflow.cx.v3beta1.TestCasesClient.ListTestCaseResultsPagedResponse)2