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()));
}
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()));
}
Aggregations