AdGroupServiceClient implements BackgroundResource { public final MutateAdGroupsResponse mutateAdGroups( String customerId, List<AdGroupOperation> operations) { MutateAdGroupsRequest request = MutateAdGroupsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateAdGroups(request); } protected  AdGroupServiceClient(AdGroupServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  AdGroupServiceClient(AdGroupServiceStub stub); static final AdGroupServiceClient create(); static final AdGroupServiceClient create(AdGroupServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final AdGroupServiceClient create(AdGroupServiceStub stub); final AdGroupServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") AdGroupServiceStub getStub(); final AdGroup getAdGroup(AdGroupName resourceName); final AdGroup getAdGroup(String resourceName); final AdGroup getAdGroup(GetAdGroupRequest request); final UnaryCallable<GetAdGroupRequest, AdGroup> getAdGroupCallable(); final MutateAdGroupsResponse mutateAdGroups(
      String customerId, List<AdGroupOperation> operations); final MutateAdGroupsResponse mutateAdGroups(MutateAdGroupsRequest request); final UnaryCallable<MutateAdGroupsRequest, MutateAdGroupsResponse> mutateAdGroupsCallable(); @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 mutateAdGroupsTest() { MutateAdGroupsResponse expectedResponse = MutateAdGroupsResponse.newBuilder().build(); mockAdGroupService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<AdGroupOperation> operations = new ArrayList<>(); MutateAdGroupsResponse actualResponse = client.mutateAdGroups(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockAdGroupService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateAdGroupsRequest actualRequest = (MutateAdGroupsRequest) 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 mutateAdGroupsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockAdGroupService.addException(exception); try { String customerId = "customerId-1772061412"; List<AdGroupOperation> operations = new ArrayList<>(); client.mutateAdGroups(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }