RecommendationServiceClient implements BackgroundResource { public final Recommendation getRecommendation(RecommendationName resourceName) { GetRecommendationRequest request = GetRecommendationRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getRecommendation(request); } protected  RecommendationServiceClient(RecommendationServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  RecommendationServiceClient(RecommendationServiceStub stub); static final RecommendationServiceClient create(); static final RecommendationServiceClient create(RecommendationServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final RecommendationServiceClient create(RecommendationServiceStub stub); final RecommendationServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") RecommendationServiceStub getStub(); final Recommendation getRecommendation(RecommendationName resourceName); final Recommendation getRecommendation(String resourceName); final Recommendation getRecommendation(GetRecommendationRequest request); final UnaryCallable<GetRecommendationRequest, Recommendation> getRecommendationCallable(); final ApplyRecommendationResponse applyRecommendation(
      String customerId, List<ApplyRecommendationOperation> operations); final ApplyRecommendationResponse applyRecommendation(ApplyRecommendationRequest request); final UnaryCallable<ApplyRecommendationRequest, ApplyRecommendationResponse> applyRecommendationCallable(); final DismissRecommendationResponse dismissRecommendation(
      String customerId,
      List<DismissRecommendationRequest.DismissRecommendationOperation> operations); final DismissRecommendationResponse dismissRecommendation(
      DismissRecommendationRequest request); final UnaryCallable<DismissRecommendationRequest, DismissRecommendationResponse> dismissRecommendationCallable(); @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 getRecommendationTest() { com.google.ads.googleads.v5.services.RecommendationName resourceName2 = com.google.ads.googleads.v5.services.RecommendationName.of( "[CUSTOMER]", "[RECOMMENDATION]"); Recommendation expectedResponse = Recommendation.newBuilder().setResourceName(resourceName2.toString()).build(); mockRecommendationService.addResponse(expectedResponse); RecommendationName resourceName = RecommendationName.of("[CUSTOMER]", "[RECOMMENDATION]"); Recommendation actualResponse = client.getRecommendation(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockRecommendationService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetRecommendationRequest actualRequest = (GetRecommendationRequest) actualRequests.get(0); Assert.assertEquals(resourceName, RecommendationName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getRecommendationExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockRecommendationService.addException(exception); try { RecommendationName resourceName = RecommendationName.of("[CUSTOMER]", "[RECOMMENDATION]"); client.getRecommendation(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }