KeywordPlanServiceClient implements BackgroundResource { public final GenerateForecastTimeSeriesResponse generateForecastTimeSeries(String keywordPlan) { GenerateForecastTimeSeriesRequest request = GenerateForecastTimeSeriesRequest.newBuilder().setKeywordPlan(keywordPlan).build(); return generateForecastTimeSeries(request); } protected  KeywordPlanServiceClient(KeywordPlanServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  KeywordPlanServiceClient(KeywordPlanServiceStub stub); static final KeywordPlanServiceClient create(); static final KeywordPlanServiceClient create(KeywordPlanServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final KeywordPlanServiceClient create(KeywordPlanServiceStub stub); final KeywordPlanServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") KeywordPlanServiceStub getStub(); final KeywordPlan getKeywordPlan(KeywordPlanName resourceName); final KeywordPlan getKeywordPlan(String resourceName); final KeywordPlan getKeywordPlan(GetKeywordPlanRequest request); final UnaryCallable<GetKeywordPlanRequest, KeywordPlan> getKeywordPlanCallable(); final MutateKeywordPlansResponse mutateKeywordPlans(
      String customerId, List<KeywordPlanOperation> operations); final MutateKeywordPlansResponse mutateKeywordPlans(MutateKeywordPlansRequest request); final UnaryCallable<MutateKeywordPlansRequest, MutateKeywordPlansResponse> mutateKeywordPlansCallable(); final GenerateForecastCurveResponse generateForecastCurve(String keywordPlan); final GenerateForecastCurveResponse generateForecastCurve(
      GenerateForecastCurveRequest request); final UnaryCallable<GenerateForecastCurveRequest, GenerateForecastCurveResponse> generateForecastCurveCallable(); final GenerateForecastTimeSeriesResponse generateForecastTimeSeries(String keywordPlan); final GenerateForecastTimeSeriesResponse generateForecastTimeSeries(
      GenerateForecastTimeSeriesRequest request); final UnaryCallable<GenerateForecastTimeSeriesRequest, GenerateForecastTimeSeriesResponse> generateForecastTimeSeriesCallable(); final GenerateForecastMetricsResponse generateForecastMetrics(String keywordPlan); final GenerateForecastMetricsResponse generateForecastMetrics(
      GenerateForecastMetricsRequest request); final UnaryCallable<GenerateForecastMetricsRequest, GenerateForecastMetricsResponse> generateForecastMetricsCallable(); final GenerateHistoricalMetricsResponse generateHistoricalMetrics(String keywordPlan); final GenerateHistoricalMetricsResponse generateHistoricalMetrics(
      GenerateHistoricalMetricsRequest request); final UnaryCallable<GenerateHistoricalMetricsRequest, GenerateHistoricalMetricsResponse> generateHistoricalMetricsCallable(); @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 generateForecastTimeSeriesTest() { GenerateForecastTimeSeriesResponse expectedResponse = GenerateForecastTimeSeriesResponse.newBuilder().build(); mockKeywordPlanService.addResponse(expectedResponse); String keywordPlan = "keywordPlan-1589809217"; GenerateForecastTimeSeriesResponse actualResponse = client.generateForecastTimeSeries(keywordPlan); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockKeywordPlanService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GenerateForecastTimeSeriesRequest actualRequest = (GenerateForecastTimeSeriesRequest) actualRequests.get(0); Assert.assertEquals(keywordPlan, actualRequest.getKeywordPlan()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void generateForecastTimeSeriesExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockKeywordPlanService.addException(exception); try { String keywordPlan = "keywordPlan-1589809217"; client.generateForecastTimeSeries(keywordPlan); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }