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