SharedCriterionServiceClient implements BackgroundResource { public final SharedCriterion getSharedCriterion(SharedCriterionName resourceName) { GetSharedCriterionRequest request = GetSharedCriterionRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getSharedCriterion(request); } protected  SharedCriterionServiceClient(SharedCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  SharedCriterionServiceClient(SharedCriterionServiceStub stub); static final SharedCriterionServiceClient create(); static final SharedCriterionServiceClient create(SharedCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final SharedCriterionServiceClient create(SharedCriterionServiceStub stub); final SharedCriterionServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") SharedCriterionServiceStub getStub(); final SharedCriterion getSharedCriterion(SharedCriterionName resourceName); final SharedCriterion getSharedCriterion(String resourceName); final SharedCriterion getSharedCriterion(GetSharedCriterionRequest request); final UnaryCallable<GetSharedCriterionRequest, SharedCriterion> getSharedCriterionCallable(); final MutateSharedCriteriaResponse mutateSharedCriteria(
      String customerId, List<SharedCriterionOperation> operations); final MutateSharedCriteriaResponse mutateSharedCriteria(
      MutateSharedCriteriaRequest request); final UnaryCallable<MutateSharedCriteriaRequest, MutateSharedCriteriaResponse> mutateSharedCriteriaCallable(); @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 getSharedCriterionTest() { com.google.ads.googleads.v5.services.SharedCriterionName resourceName2 = com.google.ads.googleads.v5.services.SharedCriterionName.of( "[CUSTOMER]", "[SHARED_CRITERION]"); SharedSetName sharedSet = SharedSetName.of("[CUSTOMER]", "[SHARED_SET]"); long criterionId = 326773895L; SharedCriterion expectedResponse = SharedCriterion.newBuilder() .setResourceName(resourceName2.toString()) .setSharedSet(sharedSet.toString()) .setCriterionId(criterionId) .build(); mockSharedCriterionService.addResponse(expectedResponse); SharedCriterionName resourceName = SharedCriterionName.of("[CUSTOMER]", "[SHARED_CRITERION]"); SharedCriterion actualResponse = client.getSharedCriterion(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockSharedCriterionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetSharedCriterionRequest actualRequest = (GetSharedCriterionRequest) actualRequests.get(0); Assert.assertEquals(resourceName, SharedCriterionName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getSharedCriterionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockSharedCriterionService.addException(exception); try { SharedCriterionName resourceName = SharedCriterionName.of("[CUSTOMER]", "[SHARED_CRITERION]"); client.getSharedCriterion(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }