Search in sources :

Example 1 with ListCompaniesPagedResponse

use of com.google.cloud.talent.v4.CompanyServiceClient.ListCompaniesPagedResponse in project java-talent by googleapis.

the class CompanyServiceClientTest method listCompaniesTest.

@Test
public void listCompaniesTest() throws Exception {
    Company responsesElement = Company.newBuilder().build();
    ListCompaniesResponse expectedResponse = ListCompaniesResponse.newBuilder().setNextPageToken("").addAllCompanies(Arrays.asList(responsesElement)).build();
    mockCompanyService.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    ListCompaniesPagedResponse pagedListResponse = client.listCompanies(parent);
    List<Company> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getCompaniesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockCompanyService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListCompaniesRequest actualRequest = ((ListCompaniesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListCompaniesPagedResponse(com.google.cloud.talent.v4beta1.CompanyServiceClient.ListCompaniesPagedResponse) Test(org.junit.Test)

Example 2 with ListCompaniesPagedResponse

use of com.google.cloud.talent.v4.CompanyServiceClient.ListCompaniesPagedResponse in project java-talent by googleapis.

the class CompanyServiceClientTest method listCompaniesTest.

@Test
public void listCompaniesTest() throws Exception {
    Company responsesElement = Company.newBuilder().build();
    ListCompaniesResponse expectedResponse = ListCompaniesResponse.newBuilder().setNextPageToken("").addAllCompanies(Arrays.asList(responsesElement)).build();
    mockCompanyService.addResponse(expectedResponse);
    TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
    ListCompaniesPagedResponse pagedListResponse = client.listCompanies(parent);
    List<Company> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getCompaniesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockCompanyService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListCompaniesRequest actualRequest = ((ListCompaniesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListCompaniesPagedResponse(com.google.cloud.talent.v4.CompanyServiceClient.ListCompaniesPagedResponse) Test(org.junit.Test)

Example 3 with ListCompaniesPagedResponse

use of com.google.cloud.talent.v4.CompanyServiceClient.ListCompaniesPagedResponse in project java-talent by googleapis.

the class CompanyServiceClientTest method listCompaniesTest2.

@Test
public void listCompaniesTest2() throws Exception {
    Company responsesElement = Company.newBuilder().build();
    ListCompaniesResponse expectedResponse = ListCompaniesResponse.newBuilder().setNextPageToken("").addAllCompanies(Arrays.asList(responsesElement)).build();
    mockCompanyService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListCompaniesPagedResponse pagedListResponse = client.listCompanies(parent);
    List<Company> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getCompaniesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockCompanyService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListCompaniesRequest actualRequest = ((ListCompaniesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListCompaniesPagedResponse(com.google.cloud.talent.v4.CompanyServiceClient.ListCompaniesPagedResponse) Test(org.junit.Test)

Example 4 with ListCompaniesPagedResponse

use of com.google.cloud.talent.v4.CompanyServiceClient.ListCompaniesPagedResponse in project java-talent by googleapis.

the class CompanyServiceClientTest method listCompaniesTest2.

@Test
public void listCompaniesTest2() throws Exception {
    Company responsesElement = Company.newBuilder().build();
    ListCompaniesResponse expectedResponse = ListCompaniesResponse.newBuilder().setNextPageToken("").addAllCompanies(Arrays.asList(responsesElement)).build();
    mockCompanyService.addResponse(expectedResponse);
    TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
    ListCompaniesPagedResponse pagedListResponse = client.listCompanies(parent);
    List<Company> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getCompaniesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockCompanyService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListCompaniesRequest actualRequest = ((ListCompaniesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListCompaniesPagedResponse(com.google.cloud.talent.v4beta1.CompanyServiceClient.ListCompaniesPagedResponse) Test(org.junit.Test)

Example 5 with ListCompaniesPagedResponse

use of com.google.cloud.talent.v4.CompanyServiceClient.ListCompaniesPagedResponse in project java-talent by googleapis.

the class CompanyServiceClientTest method listCompaniesTest3.

@Test
public void listCompaniesTest3() throws Exception {
    Company responsesElement = Company.newBuilder().build();
    ListCompaniesResponse expectedResponse = ListCompaniesResponse.newBuilder().setNextPageToken("").addAllCompanies(Arrays.asList(responsesElement)).build();
    mockCompanyService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListCompaniesPagedResponse pagedListResponse = client.listCompanies(parent);
    List<Company> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getCompaniesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockCompanyService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListCompaniesRequest actualRequest = ((ListCompaniesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListCompaniesPagedResponse(com.google.cloud.talent.v4beta1.CompanyServiceClient.ListCompaniesPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)5 Test (org.junit.Test)5 ListCompaniesPagedResponse (com.google.cloud.talent.v4beta1.CompanyServiceClient.ListCompaniesPagedResponse)3 ListCompaniesPagedResponse (com.google.cloud.talent.v4.CompanyServiceClient.ListCompaniesPagedResponse)2