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