ClickViewServiceClient implements BackgroundResource { public final ClickView getClickView(ClickViewName resourceName) { GetClickViewRequest request = GetClickViewRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getClickView(request); } protected  ClickViewServiceClient(ClickViewServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  ClickViewServiceClient(ClickViewServiceStub stub); static final ClickViewServiceClient create(); static final ClickViewServiceClient create(ClickViewServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final ClickViewServiceClient create(ClickViewServiceStub stub); final ClickViewServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") ClickViewServiceStub getStub(); final ClickView getClickView(ClickViewName resourceName); final ClickView getClickView(String resourceName); final ClickView getClickView(GetClickViewRequest request); final UnaryCallable<GetClickViewRequest, ClickView> getClickViewCallable(); @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 getClickViewTest() { com.google.ads.googleads.v5.services.ClickViewName resourceName2 = com.google.ads.googleads.v5.services.ClickViewName.of("[CUSTOMER]", "[CLICK_VIEW]"); String gclid = "gclid98179115"; long pageNumber = 1156954375L; AdGroupAdName adGroupAd = AdGroupAdName.of("[CUSTOMER]", "[AD_GROUP_AD]"); ClickView expectedResponse = ClickView.newBuilder() .setResourceName(resourceName2.toString()) .setGclid(gclid) .setPageNumber(pageNumber) .setAdGroupAd(adGroupAd.toString()) .build(); mockClickViewService.addResponse(expectedResponse); ClickViewName resourceName = ClickViewName.of("[CUSTOMER]", "[CLICK_VIEW]"); ClickView actualResponse = client.getClickView(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockClickViewService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetClickViewRequest actualRequest = (GetClickViewRequest) actualRequests.get(0); Assert.assertEquals(resourceName, ClickViewName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getClickViewExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockClickViewService.addException(exception); try { ClickViewName resourceName = ClickViewName.of("[CUSTOMER]", "[CLICK_VIEW]"); client.getClickView(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }
@Test @SuppressWarnings("all") public void getClickViewTest() { com.google.ads.googleads.v5.services.ClickViewName resourceName2 = com.google.ads.googleads.v5.services.ClickViewName.of("[CUSTOMER]", "[CLICK_VIEW]"); String gclid = "gclid98179115"; long pageNumber = 1156954375L; AdGroupAdName adGroupAd = AdGroupAdName.of("[CUSTOMER]", "[AD_GROUP_AD]"); GeoTargetConstantName campaignLocationTarget = GeoTargetConstantName.of("[GEO_TARGET_CONSTANT]"); UserListName userList = UserListName.of("[CUSTOMER]", "[USER_LIST]"); ClickView expectedResponse = ClickView.newBuilder() .setResourceName(resourceName2.toString()) .setGclid(gclid) .setPageNumber(pageNumber) .setAdGroupAd(adGroupAd.toString()) .setCampaignLocationTarget(campaignLocationTarget.toString()) .setUserList(userList.toString()) .build(); mockClickViewService.addResponse(expectedResponse); ClickViewName resourceName = ClickViewName.of("[CUSTOMER]", "[CLICK_VIEW]"); ClickView actualResponse = client.getClickView(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockClickViewService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetClickViewRequest actualRequest = (GetClickViewRequest) actualRequests.get(0); Assert.assertEquals(resourceName, ClickViewName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }