DomainCategoryServiceClient implements BackgroundResource { public final DomainCategory getDomainCategory(DomainCategoryName resourceName) { GetDomainCategoryRequest request = GetDomainCategoryRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getDomainCategory(request); } protected  DomainCategoryServiceClient(DomainCategoryServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  DomainCategoryServiceClient(DomainCategoryServiceStub stub); static final DomainCategoryServiceClient create(); static final DomainCategoryServiceClient create(DomainCategoryServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final DomainCategoryServiceClient create(DomainCategoryServiceStub stub); final DomainCategoryServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") DomainCategoryServiceStub getStub(); final DomainCategory getDomainCategory(DomainCategoryName resourceName); final DomainCategory getDomainCategory(String resourceName); final DomainCategory getDomainCategory(GetDomainCategoryRequest request); final UnaryCallable<GetDomainCategoryRequest, DomainCategory> getDomainCategoryCallable(); @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 getDomainCategoryTest() { com.google.ads.googleads.v5.services.DomainCategoryName resourceName2 = com.google.ads.googleads.v5.services.DomainCategoryName.of( "[CUSTOMER]", "[DOMAIN_CATEGORY]"); CampaignName campaign = CampaignName.of("[CUSTOMER]", "[CAMPAIGN]"); String category = "category50511102"; String languageCode = "languageCode-412800396"; String domain = "domain-1326197564"; double coverageFraction = -1.8111113E8; long categoryRank = 338802381L; boolean hasChildren = true; long recommendedCpcBidMicros = 1202568286L; DomainCategory expectedResponse = DomainCategory.newBuilder() .setResourceName(resourceName2.toString()) .setCampaign(campaign.toString()) .setCategory(category) .setLanguageCode(languageCode) .setDomain(domain) .setCoverageFraction(coverageFraction) .setCategoryRank(categoryRank) .setHasChildren(hasChildren) .setRecommendedCpcBidMicros(recommendedCpcBidMicros) .build(); mockDomainCategoryService.addResponse(expectedResponse); DomainCategoryName resourceName = DomainCategoryName.of("[CUSTOMER]", "[DOMAIN_CATEGORY]"); DomainCategory actualResponse = client.getDomainCategory(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockDomainCategoryService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetDomainCategoryRequest actualRequest = (GetDomainCategoryRequest) actualRequests.get(0); Assert.assertEquals(resourceName, DomainCategoryName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getDomainCategoryExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockDomainCategoryService.addException(exception); try { DomainCategoryName resourceName = DomainCategoryName.of("[CUSTOMER]", "[DOMAIN_CATEGORY]"); client.getDomainCategory(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }