Search in sources :

Example 1 with ListTestCasesPagedResponse

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

Example 2 with ListTestCasesPagedResponse

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

Example 3 with ListTestCasesPagedResponse

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

Example 4 with ListTestCasesPagedResponse

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

Aggregations

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