AdGroupAdServiceClient implements BackgroundResource { public final MutateAdGroupAdsResponse mutateAdGroupAds( String customerId, List<AdGroupAdOperation> operations) { MutateAdGroupAdsRequest request = MutateAdGroupAdsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateAdGroupAds(request); } protected  AdGroupAdServiceClient(AdGroupAdServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  AdGroupAdServiceClient(AdGroupAdServiceStub stub); static final AdGroupAdServiceClient create(); static final AdGroupAdServiceClient create(AdGroupAdServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final AdGroupAdServiceClient create(AdGroupAdServiceStub stub); final AdGroupAdServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") AdGroupAdServiceStub getStub(); final AdGroupAd getAdGroupAd(AdGroupAdName resourceName); final AdGroupAd getAdGroupAd(String resourceName); final AdGroupAd getAdGroupAd(GetAdGroupAdRequest request); final UnaryCallable<GetAdGroupAdRequest, AdGroupAd> getAdGroupAdCallable(); final MutateAdGroupAdsResponse mutateAdGroupAds(
      String customerId, List<AdGroupAdOperation> operations); final MutateAdGroupAdsResponse mutateAdGroupAds(MutateAdGroupAdsRequest request); final UnaryCallable<MutateAdGroupAdsRequest, MutateAdGroupAdsResponse> mutateAdGroupAdsCallable(); @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 mutateAdGroupAdsTest() { MutateAdGroupAdsResponse expectedResponse = MutateAdGroupAdsResponse.newBuilder().build(); mockAdGroupAdService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<AdGroupAdOperation> operations = new ArrayList<>(); MutateAdGroupAdsResponse actualResponse = client.mutateAdGroupAds(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdGroupAdService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateAdGroupAdsRequest actualRequest = (MutateAdGroupAdsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(operations, actualRequest.getOperationsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void mutateAdGroupAdsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockAdGroupAdService.addException(exception); try { String customerId = "customerId-1772061412"; List<AdGroupAdOperation> operations = new ArrayList<>(); client.mutateAdGroupAds(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }