KeywordPlanAdGroupServiceClient implements BackgroundResource { public final KeywordPlanAdGroup getKeywordPlanAdGroup(KeywordPlanAdGroupName resourceName) { GetKeywordPlanAdGroupRequest request = GetKeywordPlanAdGroupRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getKeywordPlanAdGroup(request); } protected  KeywordPlanAdGroupServiceClient(KeywordPlanAdGroupServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  KeywordPlanAdGroupServiceClient(KeywordPlanAdGroupServiceStub stub); static final KeywordPlanAdGroupServiceClient create(); static final KeywordPlanAdGroupServiceClient create(
      KeywordPlanAdGroupServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final KeywordPlanAdGroupServiceClient create(KeywordPlanAdGroupServiceStub stub); final KeywordPlanAdGroupServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") KeywordPlanAdGroupServiceStub getStub(); final KeywordPlanAdGroup getKeywordPlanAdGroup(KeywordPlanAdGroupName resourceName); final KeywordPlanAdGroup getKeywordPlanAdGroup(String resourceName); final KeywordPlanAdGroup getKeywordPlanAdGroup(GetKeywordPlanAdGroupRequest request); final UnaryCallable<GetKeywordPlanAdGroupRequest, KeywordPlanAdGroup> getKeywordPlanAdGroupCallable(); final MutateKeywordPlanAdGroupsResponse mutateKeywordPlanAdGroups(
      String customerId, List<KeywordPlanAdGroupOperation> operations); final MutateKeywordPlanAdGroupsResponse mutateKeywordPlanAdGroups(
      MutateKeywordPlanAdGroupsRequest request); final UnaryCallable<MutateKeywordPlanAdGroupsRequest, MutateKeywordPlanAdGroupsResponse> mutateKeywordPlanAdGroupsCallable(); @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 getKeywordPlanAdGroupTest() { com.google.ads.googleads.v5.services.KeywordPlanAdGroupName resourceName2 = com.google.ads.googleads.v5.services.KeywordPlanAdGroupName.of( "[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"); KeywordPlanAdGroup expectedResponse = KeywordPlanAdGroup.newBuilder().setResourceName(resourceName2.toString()).build(); mockKeywordPlanAdGroupService.addResponse(expectedResponse); KeywordPlanAdGroupName resourceName = KeywordPlanAdGroupName.of("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"); KeywordPlanAdGroup actualResponse = client.getKeywordPlanAdGroup(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockKeywordPlanAdGroupService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetKeywordPlanAdGroupRequest actualRequest = (GetKeywordPlanAdGroupRequest) actualRequests.get(0); Assert.assertEquals( resourceName, KeywordPlanAdGroupName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getKeywordPlanAdGroupExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockKeywordPlanAdGroupService.addException(exception); try { KeywordPlanAdGroupName resourceName = KeywordPlanAdGroupName.of("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"); client.getKeywordPlanAdGroup(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }