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