CustomInterestServiceClient implements BackgroundResource { public final MutateCustomInterestsResponse mutateCustomInterests( String customerId, List<CustomInterestOperation> operations) { MutateCustomInterestsRequest request = MutateCustomInterestsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateCustomInterests(request); } protected  CustomInterestServiceClient(CustomInterestServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CustomInterestServiceClient(CustomInterestServiceStub stub); static final CustomInterestServiceClient create(); static final CustomInterestServiceClient create(CustomInterestServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CustomInterestServiceClient create(CustomInterestServiceStub stub); final CustomInterestServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CustomInterestServiceStub getStub(); final CustomInterest getCustomInterest(CustomInterestName resourceName); final CustomInterest getCustomInterest(String resourceName); final CustomInterest getCustomInterest(GetCustomInterestRequest request); final UnaryCallable<GetCustomInterestRequest, CustomInterest> getCustomInterestCallable(); final MutateCustomInterestsResponse mutateCustomInterests(
      String customerId, List<CustomInterestOperation> operations); final MutateCustomInterestsResponse mutateCustomInterests(
      MutateCustomInterestsRequest request); final UnaryCallable<MutateCustomInterestsRequest, MutateCustomInterestsResponse> mutateCustomInterestsCallable(); @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 mutateCustomInterestsTest() { MutateCustomInterestsResponse expectedResponse = MutateCustomInterestsResponse.newBuilder().build(); mockCustomInterestService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<CustomInterestOperation> operations = new ArrayList<>(); MutateCustomInterestsResponse actualResponse = client.mutateCustomInterests(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCustomInterestService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateCustomInterestsRequest actualRequest = (MutateCustomInterestsRequest) 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 mutateCustomInterestsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCustomInterestService.addException(exception); try { String customerId = "customerId-1772061412"; List<CustomInterestOperation> operations = new ArrayList<>(); client.mutateCustomInterests(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }