CustomerNegativeCriterionServiceClient implements BackgroundResource { public final CustomerNegativeCriterion getCustomerNegativeCriterion( CustomerNegativeCriterionName resourceName) { GetCustomerNegativeCriterionRequest request = GetCustomerNegativeCriterionRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getCustomerNegativeCriterion(request); } protected  CustomerNegativeCriterionServiceClient(
      CustomerNegativeCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  CustomerNegativeCriterionServiceClient(CustomerNegativeCriterionServiceStub stub); static final CustomerNegativeCriterionServiceClient create(); static final CustomerNegativeCriterionServiceClient create(
      CustomerNegativeCriterionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final CustomerNegativeCriterionServiceClient create(
      CustomerNegativeCriterionServiceStub stub); final CustomerNegativeCriterionServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") CustomerNegativeCriterionServiceStub getStub(); final CustomerNegativeCriterion getCustomerNegativeCriterion(
      CustomerNegativeCriterionName resourceName); final CustomerNegativeCriterion getCustomerNegativeCriterion(String resourceName); final CustomerNegativeCriterion getCustomerNegativeCriterion(
      GetCustomerNegativeCriterionRequest request); final UnaryCallable<GetCustomerNegativeCriterionRequest, CustomerNegativeCriterion> getCustomerNegativeCriterionCallable(); final MutateCustomerNegativeCriteriaResponse mutateCustomerNegativeCriteria(
      String customerId, List<CustomerNegativeCriterionOperation> operations); final MutateCustomerNegativeCriteriaResponse mutateCustomerNegativeCriteria(
      MutateCustomerNegativeCriteriaRequest request); final UnaryCallable<
          MutateCustomerNegativeCriteriaRequest, MutateCustomerNegativeCriteriaResponse> mutateCustomerNegativeCriteriaCallable(); @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 getCustomerNegativeCriterionTest() { com.google.ads.googleads.v5.services.CustomerNegativeCriterionName resourceName2 = com.google.ads.googleads.v5.services.CustomerNegativeCriterionName.of( "[CUSTOMER]", "[CUSTOMER_NEGATIVE_CRITERION]"); long id = 3355L; CustomerNegativeCriterion expectedResponse = CustomerNegativeCriterion.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .build(); mockCustomerNegativeCriterionService.addResponse(expectedResponse); CustomerNegativeCriterionName resourceName = CustomerNegativeCriterionName.of("[CUSTOMER]", "[CUSTOMER_NEGATIVE_CRITERION]"); CustomerNegativeCriterion actualResponse = client.getCustomerNegativeCriterion(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockCustomerNegativeCriterionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetCustomerNegativeCriterionRequest actualRequest = (GetCustomerNegativeCriterionRequest) actualRequests.get(0); Assert.assertEquals( resourceName, CustomerNegativeCriterionName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getCustomerNegativeCriterionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockCustomerNegativeCriterionService.addException(exception); try { CustomerNegativeCriterionName resourceName = CustomerNegativeCriterionName.of("[CUSTOMER]", "[CUSTOMER_NEGATIVE_CRITERION]"); client.getCustomerNegativeCriterion(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }