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