LabelServiceClient implements BackgroundResource { public final Label getLabel(LabelName resourceName) { GetLabelRequest request = GetLabelRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getLabel(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 getLabelTest() { com.google.ads.googleads.v5.services.LabelName resourceName2 = com.google.ads.googleads.v5.services.LabelName.of("[CUSTOMER]", "[LABEL]"); Label expectedResponse = Label.newBuilder().setResourceName(resourceName2.toString()).build(); mockLabelService.addResponse(expectedResponse); LabelName resourceName = LabelName.of("[CUSTOMER]", "[LABEL]"); Label actualResponse = client.getLabel(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockLabelService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetLabelRequest actualRequest = (GetLabelRequest) actualRequests.get(0); Assert.assertEquals(resourceName, LabelName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getLabelExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockLabelService.addException(exception); try { LabelName resourceName = LabelName.of("[CUSTOMER]", "[LABEL]"); client.getLabel(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }