ReachPlanServiceClient implements BackgroundResource { public final GenerateProductMixIdeasResponse generateProductMixIdeas( String customerId, StringValue plannableLocationId, StringValue currencyCode, Int64Value budgetMicros) { GenerateProductMixIdeasRequest request = GenerateProductMixIdeasRequest.newBuilder() .setCustomerId(customerId) .setPlannableLocationId(plannableLocationId) .setCurrencyCode(currencyCode) .setBudgetMicros(budgetMicros) .build(); return generateProductMixIdeas(request); } protected  ReachPlanServiceClient(ReachPlanServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  ReachPlanServiceClient(ReachPlanServiceStub stub); static final ReachPlanServiceClient create(); static final ReachPlanServiceClient create(ReachPlanServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final ReachPlanServiceClient create(ReachPlanServiceStub stub); final ReachPlanServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") ReachPlanServiceStub getStub(); final ListPlannableLocationsResponse listPlannableLocations(
      ListPlannableLocationsRequest request); final UnaryCallable<ListPlannableLocationsRequest, ListPlannableLocationsResponse> listPlannableLocationsCallable(); final ListPlannableProductsResponse listPlannableProducts(
      StringValue plannableLocationId); final ListPlannableProductsResponse listPlannableProducts(
      ListPlannableProductsRequest request); final UnaryCallable<ListPlannableProductsRequest, ListPlannableProductsResponse> listPlannableProductsCallable(); final GenerateProductMixIdeasResponse generateProductMixIdeas(
      String customerId,
      StringValue plannableLocationId,
      StringValue currencyCode,
      Int64Value budgetMicros); final GenerateProductMixIdeasResponse generateProductMixIdeas(
      GenerateProductMixIdeasRequest request); final UnaryCallable<GenerateProductMixIdeasRequest, GenerateProductMixIdeasResponse> generateProductMixIdeasCallable(); final GenerateReachForecastResponse generateReachForecast(
      String customerId, CampaignDuration campaignDuration, List<PlannedProduct> plannedProducts); final GenerateReachForecastResponse generateReachForecast(
      GenerateReachForecastRequest request); final UnaryCallable<GenerateReachForecastRequest, GenerateReachForecastResponse> generateReachForecastCallable(); @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 generateProductMixIdeasTest() { GenerateProductMixIdeasResponse expectedResponse = GenerateProductMixIdeasResponse.newBuilder().build(); mockReachPlanService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; StringValue plannableLocationId = StringValue.newBuilder().build(); StringValue currencyCode = StringValue.newBuilder().build(); Int64Value budgetMicros = Int64Value.newBuilder().build(); GenerateProductMixIdeasResponse actualResponse = client.generateProductMixIdeas(customerId, plannableLocationId, currencyCode, budgetMicros); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockReachPlanService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GenerateProductMixIdeasRequest actualRequest = (GenerateProductMixIdeasRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(plannableLocationId, actualRequest.getPlannableLocationId()); Assert.assertEquals(currencyCode, actualRequest.getCurrencyCode()); Assert.assertEquals(budgetMicros, actualRequest.getBudgetMicros()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void generateProductMixIdeasExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockReachPlanService.addException(exception); try { String customerId = "customerId-1772061412"; StringValue plannableLocationId = StringValue.newBuilder().build(); StringValue currencyCode = StringValue.newBuilder().build(); Int64Value budgetMicros = Int64Value.newBuilder().build(); client.generateProductMixIdeas(customerId, plannableLocationId, currencyCode, budgetMicros); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }