use of com.google.cloud.talent.v4beta1.ProfileServiceClient.SearchProfilesPagedResponse in project java-talent by googleapis.
the class ProfileServiceClientTest method searchProfilesTest.
@Test
public void searchProfilesTest() throws Exception {
HistogramQueryResult responsesElement = HistogramQueryResult.newBuilder().build();
SearchProfilesResponse expectedResponse = SearchProfilesResponse.newBuilder().setNextPageToken("").addAllHistogramQueryResults(Arrays.asList(responsesElement)).build();
mockProfileService.addResponse(expectedResponse);
SearchProfilesRequest request = SearchProfilesRequest.newBuilder().setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()).setRequestMetadata(RequestMetadata.newBuilder().build()).setProfileQuery(ProfileQuery.newBuilder().build()).setPageSize(883849137).setPageToken("pageToken873572522").setOffset(-1019779949).setDisableSpellCheck(true).setOrderBy("orderBy-1207110587").setCaseSensitiveSort(true).addAllHistogramQueries(new ArrayList<HistogramQuery>()).setResultSetId("resultSetId-548600064").setStrictKeywordsSearch(true).build();
SearchProfilesPagedResponse pagedListResponse = client.searchProfiles(request);
List<HistogramQueryResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getHistogramQueryResultsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockProfileService.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchProfilesRequest actualRequest = ((SearchProfilesRequest) actualRequests.get(0));
Assert.assertEquals(request.getParent(), actualRequest.getParent());
Assert.assertEquals(request.getRequestMetadata(), actualRequest.getRequestMetadata());
Assert.assertEquals(request.getProfileQuery(), actualRequest.getProfileQuery());
Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize());
Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken());
Assert.assertEquals(request.getOffset(), actualRequest.getOffset());
Assert.assertEquals(request.getDisableSpellCheck(), actualRequest.getDisableSpellCheck());
Assert.assertEquals(request.getOrderBy(), actualRequest.getOrderBy());
Assert.assertEquals(request.getCaseSensitiveSort(), actualRequest.getCaseSensitiveSort());
Assert.assertEquals(request.getHistogramQueriesList(), actualRequest.getHistogramQueriesList());
Assert.assertEquals(request.getResultSetId(), actualRequest.getResultSetId());
Assert.assertEquals(request.getStrictKeywordsSearch(), actualRequest.getStrictKeywordsSearch());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations