ChangeStatusServiceClient implements BackgroundResource { public final ChangeStatus getChangeStatus(ChangeStatusName resourceName) { GetChangeStatusRequest request = GetChangeStatusRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getChangeStatus(request); } protected  ChangeStatusServiceClient(ChangeStatusServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  ChangeStatusServiceClient(ChangeStatusServiceStub stub); static final ChangeStatusServiceClient create(); static final ChangeStatusServiceClient create(ChangeStatusServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final ChangeStatusServiceClient create(ChangeStatusServiceStub stub); final ChangeStatusServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") ChangeStatusServiceStub getStub(); final ChangeStatus getChangeStatus(ChangeStatusName resourceName); final ChangeStatus getChangeStatus(String resourceName); final ChangeStatus getChangeStatus(GetChangeStatusRequest request); final UnaryCallable<GetChangeStatusRequest, ChangeStatus> getChangeStatusCallable(); @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 getChangeStatusTest() { com.google.ads.googleads.v5.services.ChangeStatusName resourceName2 = com.google.ads.googleads.v5.services.ChangeStatusName.of("[CUSTOMER]", "[CHANGE_STATUS]"); CampaignName campaign = CampaignName.of("[CUSTOMER]", "[CAMPAIGN]"); AdGroupName adGroup = AdGroupName.of("[CUSTOMER]", "[AD_GROUP]"); ChangeStatus expectedResponse = ChangeStatus.newBuilder() .setResourceName(resourceName2.toString()) .setCampaign(campaign.toString()) .setAdGroup(adGroup.toString()) .build(); mockChangeStatusService.addResponse(expectedResponse); ChangeStatusName resourceName = ChangeStatusName.of("[CUSTOMER]", "[CHANGE_STATUS]"); ChangeStatus actualResponse = client.getChangeStatus(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockChangeStatusService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetChangeStatusRequest actualRequest = (GetChangeStatusRequest) actualRequests.get(0); Assert.assertEquals(resourceName, ChangeStatusName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getChangeStatusExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockChangeStatusService.addException(exception); try { ChangeStatusName resourceName = ChangeStatusName.of("[CUSTOMER]", "[CHANGE_STATUS]"); client.getChangeStatus(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }