PaidOrganicSearchTermViewServiceClient implements BackgroundResource { public final PaidOrganicSearchTermView getPaidOrganicSearchTermView( PaidOrganicSearchTermViewName resourceName) { GetPaidOrganicSearchTermViewRequest request = GetPaidOrganicSearchTermViewRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getPaidOrganicSearchTermView(request); } protected  PaidOrganicSearchTermViewServiceClient(
      PaidOrganicSearchTermViewServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  PaidOrganicSearchTermViewServiceClient(PaidOrganicSearchTermViewServiceStub stub); static final PaidOrganicSearchTermViewServiceClient create(); static final PaidOrganicSearchTermViewServiceClient create(
      PaidOrganicSearchTermViewServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final PaidOrganicSearchTermViewServiceClient create(
      PaidOrganicSearchTermViewServiceStub stub); final PaidOrganicSearchTermViewServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") PaidOrganicSearchTermViewServiceStub getStub(); final PaidOrganicSearchTermView getPaidOrganicSearchTermView(
      PaidOrganicSearchTermViewName resourceName); final PaidOrganicSearchTermView getPaidOrganicSearchTermView(String resourceName); final PaidOrganicSearchTermView getPaidOrganicSearchTermView(
      GetPaidOrganicSearchTermViewRequest request); final UnaryCallable<GetPaidOrganicSearchTermViewRequest, PaidOrganicSearchTermView> getPaidOrganicSearchTermViewCallable(); @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 getPaidOrganicSearchTermViewTest() { com.google.ads.googleads.v5.services.PaidOrganicSearchTermViewName resourceName2 = com.google.ads.googleads.v5.services.PaidOrganicSearchTermViewName.of( "[CUSTOMER]", "[PAID_ORGANIC_SEARCH_TERM_VIEW]"); PaidOrganicSearchTermView expectedResponse = PaidOrganicSearchTermView.newBuilder().setResourceName(resourceName2.toString()).build(); mockPaidOrganicSearchTermViewService.addResponse(expectedResponse); PaidOrganicSearchTermViewName resourceName = PaidOrganicSearchTermViewName.of("[CUSTOMER]", "[PAID_ORGANIC_SEARCH_TERM_VIEW]"); PaidOrganicSearchTermView actualResponse = client.getPaidOrganicSearchTermView(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockPaidOrganicSearchTermViewService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetPaidOrganicSearchTermViewRequest actualRequest = (GetPaidOrganicSearchTermViewRequest) actualRequests.get(0); Assert.assertEquals( resourceName, PaidOrganicSearchTermViewName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getPaidOrganicSearchTermViewExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockPaidOrganicSearchTermViewService.addException(exception); try { PaidOrganicSearchTermViewName resourceName = PaidOrganicSearchTermViewName.of("[CUSTOMER]", "[PAID_ORGANIC_SEARCH_TERM_VIEW]"); client.getPaidOrganicSearchTermView(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }