Search in sources :

Example 1 with ListProjectBillingInfoPagedResponse

use of com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse in project java-billing by googleapis.

the class CloudBillingClientTest method listProjectBillingInfoTest2.

@Test
public void listProjectBillingInfoTest2() throws Exception {
    ProjectBillingInfo responsesElement = ProjectBillingInfo.newBuilder().build();
    ListProjectBillingInfoResponse expectedResponse = ListProjectBillingInfoResponse.newBuilder().setNextPageToken("").addAllProjectBillingInfo(Arrays.asList(responsesElement)).build();
    mockCloudBilling.addResponse(expectedResponse);
    String name = "name3373707";
    ListProjectBillingInfoPagedResponse pagedListResponse = client.listProjectBillingInfo(name);
    List<ProjectBillingInfo> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProjectBillingInfoList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockCloudBilling.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProjectBillingInfoRequest actualRequest = ((ListProjectBillingInfoRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListProjectBillingInfoPagedResponse(com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 2 with ListProjectBillingInfoPagedResponse

use of com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse in project java-billing by googleapis.

the class CloudBillingClientTest method listProjectBillingInfoTest.

@Test
public void listProjectBillingInfoTest() throws Exception {
    ProjectBillingInfo responsesElement = ProjectBillingInfo.newBuilder().build();
    ListProjectBillingInfoResponse expectedResponse = ListProjectBillingInfoResponse.newBuilder().setNextPageToken("").addAllProjectBillingInfo(Arrays.asList(responsesElement)).build();
    mockCloudBilling.addResponse(expectedResponse);
    BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
    ListProjectBillingInfoPagedResponse pagedListResponse = client.listProjectBillingInfo(name);
    List<ProjectBillingInfo> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProjectBillingInfoList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockCloudBilling.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProjectBillingInfoRequest actualRequest = ((ListProjectBillingInfoRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListProjectBillingInfoPagedResponse(com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse) Test(org.junit.Test)

Aggregations

ListProjectBillingInfoPagedResponse (com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2 ByteString (com.google.protobuf.ByteString)1