Search in sources :

Example 1 with ListApplicationsPagedResponse

use of com.google.cloud.talent.v4beta1.ApplicationServiceClient.ListApplicationsPagedResponse in project java-talent by googleapis.

the class ApplicationServiceClientTest method listApplicationsTest2.

@Test
public void listApplicationsTest2() throws Exception {
    Application responsesElement = Application.newBuilder().build();
    ListApplicationsResponse expectedResponse = ListApplicationsResponse.newBuilder().setNextPageToken("").addAllApplications(Arrays.asList(responsesElement)).build();
    mockApplicationService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListApplicationsPagedResponse pagedListResponse = client.listApplications(parent);
    List<Application> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getApplicationsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockApplicationService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListApplicationsRequest actualRequest = ((ListApplicationsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListApplicationsPagedResponse(com.google.cloud.talent.v4beta1.ApplicationServiceClient.ListApplicationsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 2 with ListApplicationsPagedResponse

use of com.google.cloud.talent.v4beta1.ApplicationServiceClient.ListApplicationsPagedResponse in project java-talent by googleapis.

the class ApplicationServiceClientTest method listApplicationsTest.

@Test
public void listApplicationsTest() throws Exception {
    Application responsesElement = Application.newBuilder().build();
    ListApplicationsResponse expectedResponse = ListApplicationsResponse.newBuilder().setNextPageToken("").addAllApplications(Arrays.asList(responsesElement)).build();
    mockApplicationService.addResponse(expectedResponse);
    ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
    ListApplicationsPagedResponse pagedListResponse = client.listApplications(parent);
    List<Application> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getApplicationsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockApplicationService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListApplicationsRequest actualRequest = ((ListApplicationsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListApplicationsPagedResponse(com.google.cloud.talent.v4beta1.ApplicationServiceClient.ListApplicationsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Aggregations

ListApplicationsPagedResponse (com.google.cloud.talent.v4beta1.ApplicationServiceClient.ListApplicationsPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2