Search in sources :

Example 1 with ListContinuousTestResultsPagedResponse

use of com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListContinuousTestResultsPagedResponse in project java-dialogflow-cx by googleapis.

the class EnvironmentsClientTest method listContinuousTestResultsTest2.

@Test
public void listContinuousTestResultsTest2() throws Exception {
    ContinuousTestResult responsesElement = ContinuousTestResult.newBuilder().build();
    ListContinuousTestResultsResponse expectedResponse = ListContinuousTestResultsResponse.newBuilder().setNextPageToken("").addAllContinuousTestResults(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListContinuousTestResultsPagedResponse pagedListResponse = client.listContinuousTestResults(parent);
    List<ContinuousTestResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getContinuousTestResultsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListContinuousTestResultsRequest actualRequest = ((ListContinuousTestResultsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListContinuousTestResultsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListContinuousTestResultsPagedResponse) Test(org.junit.Test)

Example 2 with ListContinuousTestResultsPagedResponse

use of com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListContinuousTestResultsPagedResponse in project java-dialogflow-cx by googleapis.

the class EnvironmentsClientTest method listContinuousTestResultsTest.

@Test
public void listContinuousTestResultsTest() throws Exception {
    ContinuousTestResult responsesElement = ContinuousTestResult.newBuilder().build();
    ListContinuousTestResultsResponse expectedResponse = ListContinuousTestResultsResponse.newBuilder().setNextPageToken("").addAllContinuousTestResults(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
    ListContinuousTestResultsPagedResponse pagedListResponse = client.listContinuousTestResults(parent);
    List<ContinuousTestResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getContinuousTestResultsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListContinuousTestResultsRequest actualRequest = ((ListContinuousTestResultsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListContinuousTestResultsPagedResponse(com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListContinuousTestResultsPagedResponse) Test(org.junit.Test)

Example 3 with ListContinuousTestResultsPagedResponse

use of com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListContinuousTestResultsPagedResponse in project java-dialogflow-cx by googleapis.

the class EnvironmentsClientTest method listContinuousTestResultsTest.

@Test
public void listContinuousTestResultsTest() throws Exception {
    ContinuousTestResult responsesElement = ContinuousTestResult.newBuilder().build();
    ListContinuousTestResultsResponse expectedResponse = ListContinuousTestResultsResponse.newBuilder().setNextPageToken("").addAllContinuousTestResults(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
    ListContinuousTestResultsPagedResponse pagedListResponse = client.listContinuousTestResults(parent);
    List<ContinuousTestResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getContinuousTestResultsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListContinuousTestResultsRequest actualRequest = ((ListContinuousTestResultsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListContinuousTestResultsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListContinuousTestResultsPagedResponse) Test(org.junit.Test)

Example 4 with ListContinuousTestResultsPagedResponse

use of com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListContinuousTestResultsPagedResponse in project java-dialogflow-cx by googleapis.

the class EnvironmentsClientTest method listContinuousTestResultsTest2.

@Test
public void listContinuousTestResultsTest2() throws Exception {
    ContinuousTestResult responsesElement = ContinuousTestResult.newBuilder().build();
    ListContinuousTestResultsResponse expectedResponse = ListContinuousTestResultsResponse.newBuilder().setNextPageToken("").addAllContinuousTestResults(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListContinuousTestResultsPagedResponse pagedListResponse = client.listContinuousTestResults(parent);
    List<ContinuousTestResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getContinuousTestResultsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListContinuousTestResultsRequest actualRequest = ((ListContinuousTestResultsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListContinuousTestResultsPagedResponse(com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListContinuousTestResultsPagedResponse) Test(org.junit.Test)

Aggregations

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