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