Search in sources :

Example 1 with ListProfilesPagedResponse

use of com.google.cloud.talent.v4beta1.ProfileServiceClient.ListProfilesPagedResponse in project java-talent by googleapis.

the class ProfileServiceClientTest method listProfilesTest.

@Test
public void listProfilesTest() throws Exception {
    Profile responsesElement = Profile.newBuilder().build();
    ListProfilesResponse expectedResponse = ListProfilesResponse.newBuilder().setNextPageToken("").addAllProfiles(Arrays.asList(responsesElement)).build();
    mockProfileService.addResponse(expectedResponse);
    TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
    ListProfilesPagedResponse pagedListResponse = client.listProfiles(parent);
    List<Profile> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProfilesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockProfileService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProfilesRequest actualRequest = ((ListProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListProfilesPagedResponse(com.google.cloud.talent.v4beta1.ProfileServiceClient.ListProfilesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 2 with ListProfilesPagedResponse

use of com.google.cloud.talent.v4beta1.ProfileServiceClient.ListProfilesPagedResponse in project java-talent by googleapis.

the class ProfileServiceClientTest method listProfilesTest2.

@Test
public void listProfilesTest2() throws Exception {
    Profile responsesElement = Profile.newBuilder().build();
    ListProfilesResponse expectedResponse = ListProfilesResponse.newBuilder().setNextPageToken("").addAllProfiles(Arrays.asList(responsesElement)).build();
    mockProfileService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListProfilesPagedResponse pagedListResponse = client.listProfiles(parent);
    List<Profile> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProfilesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockProfileService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProfilesRequest actualRequest = ((ListProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListProfilesPagedResponse(com.google.cloud.talent.v4beta1.ProfileServiceClient.ListProfilesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Aggregations

ListProfilesPagedResponse (com.google.cloud.talent.v4beta1.ProfileServiceClient.ListProfilesPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2