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