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