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