LabelServiceClient implements BackgroundResource { public final MutateLabelsResponse mutateLabels( String customerId, List<LabelOperation> operations) { MutateLabelsRequest request = MutateLabelsRequest.newBuilder() .setCustomerId(customerId) .addAllOperations(operations) .build(); return mutateLabels(request); } protected  LabelServiceClient(LabelServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  LabelServiceClient(LabelServiceStub stub); static final LabelServiceClient create(); static final LabelServiceClient create(LabelServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final LabelServiceClient create(LabelServiceStub stub); final LabelServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") LabelServiceStub getStub(); final Label getLabel(LabelName resourceName); final Label getLabel(String resourceName); final Label getLabel(GetLabelRequest request); final UnaryCallable<GetLabelRequest, Label> getLabelCallable(); final MutateLabelsResponse mutateLabels(
      String customerId, List<LabelOperation> operations); final MutateLabelsResponse mutateLabels(MutateLabelsRequest request); final UnaryCallable<MutateLabelsRequest, MutateLabelsResponse> mutateLabelsCallable(); @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 mutateLabelsTest() { MutateLabelsResponse expectedResponse = MutateLabelsResponse.newBuilder().build(); mockLabelService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<LabelOperation> operations = new ArrayList<>(); MutateLabelsResponse actualResponse = client.mutateLabels(customerId, operations); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockLabelService.getRequests(); Assert.assertEquals(1, actualRequests.size()); MutateLabelsRequest actualRequest = (MutateLabelsRequest) 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 mutateLabelsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockLabelService.addException(exception); try { String customerId = "customerId-1772061412"; List<LabelOperation> operations = new ArrayList<>(); client.mutateLabels(customerId, operations); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }