CampaignDraftServiceClient implements BackgroundResource { public final ListCampaignDraftAsyncErrorsPagedResponse listCampaignDraftAsyncErrors( CampaignDraftName resourceName) { ListCampaignDraftAsyncErrorsRequest request = ListCampaignDraftAsyncErrorsRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return listCampaignDraftAsyncErrors(request); } protected  CampaignDraftServiceClient(CampaignDraftServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CampaignDraftServiceClient(CampaignDraftServiceStub stub); static final CampaignDraftServiceClient create(); static final CampaignDraftServiceClient create(CampaignDraftServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CampaignDraftServiceClient create(CampaignDraftServiceStub stub); final CampaignDraftServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CampaignDraftServiceStub getStub(); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationsClient getOperationsClient(); final CampaignDraft getCampaignDraft(CampaignDraftName resourceName); final CampaignDraft getCampaignDraft(String resourceName); final CampaignDraft getCampaignDraft(GetCampaignDraftRequest request); final UnaryCallable<GetCampaignDraftRequest, CampaignDraft> getCampaignDraftCallable(); final MutateCampaignDraftsResponse mutateCampaignDrafts(
      String customerId, List<CampaignDraftOperation> operations); final MutateCampaignDraftsResponse mutateCampaignDrafts(
      MutateCampaignDraftsRequest request); final UnaryCallable<MutateCampaignDraftsRequest, MutateCampaignDraftsResponse> mutateCampaignDraftsCallable(); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationFuture<Empty, Empty> promoteCampaignDraftAsync(String campaignDraft); @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") final OperationFuture<Empty, Empty> promoteCampaignDraftAsync(
      PromoteCampaignDraftRequest request); @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") final OperationCallable<PromoteCampaignDraftRequest, Empty, Empty> promoteCampaignDraftOperationCallable(); final UnaryCallable<PromoteCampaignDraftRequest, Operation> promoteCampaignDraftCallable(); final ListCampaignDraftAsyncErrorsPagedResponse listCampaignDraftAsyncErrors(
      CampaignDraftName resourceName); final ListCampaignDraftAsyncErrorsPagedResponse listCampaignDraftAsyncErrors(
      String resourceName); final ListCampaignDraftAsyncErrorsPagedResponse listCampaignDraftAsyncErrors(
      ListCampaignDraftAsyncErrorsRequest request); final UnaryCallable<
          ListCampaignDraftAsyncErrorsRequest, ListCampaignDraftAsyncErrorsPagedResponse> listCampaignDraftAsyncErrorsPagedCallable(); final UnaryCallable<
          ListCampaignDraftAsyncErrorsRequest, ListCampaignDraftAsyncErrorsResponse> listCampaignDraftAsyncErrorsCallable(); @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 listCampaignDraftAsyncErrorsTest() { String nextPageToken = ""; com.google.rpc.Status errorsElement = com.google.rpc.Status.newBuilder().build(); List<com.google.rpc.Status> errors = Arrays.asList(errorsElement); ListCampaignDraftAsyncErrorsResponse expectedResponse = ListCampaignDraftAsyncErrorsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllErrors(errors) .build(); mockCampaignDraftService.addResponse(expectedResponse); CampaignDraftName resourceName = CampaignDraftName.of("[CUSTOMER]", "[CAMPAIGN_DRAFT]"); ListCampaignDraftAsyncErrorsPagedResponse pagedListResponse = client.listCampaignDraftAsyncErrors(resourceName); List<com.google.rpc.Status> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getErrorsList().get(0), resources.get(0)); List<AbstractMessage> actualRequests = mockCampaignDraftService.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListCampaignDraftAsyncErrorsRequest actualRequest = (ListCampaignDraftAsyncErrorsRequest) actualRequests.get(0); Assert.assertEquals(resourceName, CampaignDraftName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void listCampaignDraftAsyncErrorsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCampaignDraftService.addException(exception); try { CampaignDraftName resourceName = CampaignDraftName.of("[CUSTOMER]", "[CAMPAIGN_DRAFT]"); client.listCampaignDraftAsyncErrors(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }