AccountBudgetServiceClient implements BackgroundResource { public final AccountBudget getAccountBudget(AccountBudgetName resourceName) { GetAccountBudgetRequest request = GetAccountBudgetRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getAccountBudget(request); } protected  AccountBudgetServiceClient(AccountBudgetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  AccountBudgetServiceClient(AccountBudgetServiceStub stub); static final AccountBudgetServiceClient create(); static final AccountBudgetServiceClient create(AccountBudgetServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final AccountBudgetServiceClient create(AccountBudgetServiceStub stub); final AccountBudgetServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") AccountBudgetServiceStub getStub(); final AccountBudget getAccountBudget(AccountBudgetName resourceName); final AccountBudget getAccountBudget(String resourceName); final AccountBudget getAccountBudget(GetAccountBudgetRequest request); final UnaryCallable<GetAccountBudgetRequest, AccountBudget> getAccountBudgetCallable(); @Override final void close(); @Override void shutdown(); @Override boolean isShutdown(); @Override boolean isTerminated(); @Override void shutdownNow(); @Override boolean awaitTermination(long duration, TimeUnit unit);  }
@Test @SuppressWarnings("all") public void getAccountBudgetTest() { com.google.ads.googleads.v5.services.AccountBudgetName resourceName2 = com.google.ads.googleads.v5.services.AccountBudgetName.of( "[CUSTOMER]", "[ACCOUNT_BUDGET]"); long id = 3355L; BillingSetupName billingSetup = BillingSetupName.of("[CUSTOMER]", "[BILLING_SETUP]"); com.google.ads.googleads.v5.services.AccountBudgetName name = com.google.ads.googleads.v5.services.AccountBudgetName.of( "[CUSTOMER]", "[ACCOUNT_BUDGET]"); String proposedStartDateTime = "proposedStartDateTime1279924808"; String approvedStartDateTime = "approvedStartDateTime-58305639"; long totalAdjustmentsMicros = 1469082819L; long amountServedMicros = 1848146642L; String purchaseOrderNumber = "purchaseOrderNumber1774283736"; String notes = "notes105008833"; String proposedEndDateTime = "proposedEndDateTime1799190849"; String approvedEndDateTime = "approvedEndDateTime-450243886"; long proposedSpendingLimitMicros = 368712267L; long approvedSpendingLimitMicros = 2102140486L; long adjustedSpendingLimitMicros = 1818287939L; AccountBudget expectedResponse = AccountBudget.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .setBillingSetup(billingSetup.toString()) .setName(name.toString()) .setProposedStartDateTime(proposedStartDateTime) .setApprovedStartDateTime(approvedStartDateTime) .setTotalAdjustmentsMicros(totalAdjustmentsMicros) .setAmountServedMicros(amountServedMicros) .setPurchaseOrderNumber(purchaseOrderNumber) .setNotes(notes) .setProposedEndDateTime(proposedEndDateTime) .setApprovedEndDateTime(approvedEndDateTime) .setProposedSpendingLimitMicros(proposedSpendingLimitMicros) .setApprovedSpendingLimitMicros(approvedSpendingLimitMicros) .setAdjustedSpendingLimitMicros(adjustedSpendingLimitMicros) .build(); mockAccountBudgetService.addResponse(expectedResponse); AccountBudgetName resourceName = AccountBudgetName.of("[CUSTOMER]", "[ACCOUNT_BUDGET]"); AccountBudget actualResponse = client.getAccountBudget(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAccountBudgetService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetAccountBudgetRequest actualRequest = (GetAccountBudgetRequest) actualRequests.get(0); Assert.assertEquals(resourceName, AccountBudgetName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getAccountBudgetExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockAccountBudgetService.addException(exception); try { AccountBudgetName resourceName = AccountBudgetName.of("[CUSTOMER]", "[ACCOUNT_BUDGET]"); client.getAccountBudget(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }