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