PaymentsAccountServiceClient implements BackgroundResource { public final ListPaymentsAccountsResponse listPaymentsAccounts(String customerId) { ListPaymentsAccountsRequest request = ListPaymentsAccountsRequest.newBuilder().setCustomerId(customerId).build(); return listPaymentsAccounts(request); } protected  PaymentsAccountServiceClient(PaymentsAccountServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  PaymentsAccountServiceClient(PaymentsAccountServiceStub stub); static final PaymentsAccountServiceClient create(); static final PaymentsAccountServiceClient create(PaymentsAccountServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final PaymentsAccountServiceClient create(PaymentsAccountServiceStub stub); final PaymentsAccountServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") PaymentsAccountServiceStub getStub(); final ListPaymentsAccountsResponse listPaymentsAccounts(String customerId); final ListPaymentsAccountsResponse listPaymentsAccounts(
      ListPaymentsAccountsRequest request); final UnaryCallable<ListPaymentsAccountsRequest, ListPaymentsAccountsResponse> listPaymentsAccountsCallable(); @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 listPaymentsAccountsTest() { ListPaymentsAccountsResponse expectedResponse = ListPaymentsAccountsResponse.newBuilder().build(); mockPaymentsAccountService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; ListPaymentsAccountsResponse actualResponse = client.listPaymentsAccounts(customerId); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockPaymentsAccountService.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListPaymentsAccountsRequest actualRequest = (ListPaymentsAccountsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void listPaymentsAccountsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockPaymentsAccountService.addException(exception); try { String customerId = "customerId-1772061412"; client.listPaymentsAccounts(customerId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }