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