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