ConversionActionServiceClient implements BackgroundResource { public final ConversionAction getConversionAction(ConversionActionName resourceName) { GetConversionActionRequest request = GetConversionActionRequest.newBuilder() .setResourceName(resourceName == null ? null : resourceName.toString()) .build(); return getConversionAction(request); } protected  ConversionActionServiceClient(ConversionActionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  ConversionActionServiceClient(ConversionActionServiceStub stub); static final ConversionActionServiceClient create(); static final ConversionActionServiceClient create(ConversionActionServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final ConversionActionServiceClient create(ConversionActionServiceStub stub); final ConversionActionServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") ConversionActionServiceStub getStub(); final ConversionAction getConversionAction(ConversionActionName resourceName); final ConversionAction getConversionAction(String resourceName); final ConversionAction getConversionAction(GetConversionActionRequest request); final UnaryCallable<GetConversionActionRequest, ConversionAction> getConversionActionCallable(); final MutateConversionActionsResponse mutateConversionActions(
      String customerId, List<ConversionActionOperation> operations); final MutateConversionActionsResponse mutateConversionActions(
      MutateConversionActionsRequest request); final UnaryCallable<MutateConversionActionsRequest, MutateConversionActionsResponse> mutateConversionActionsCallable(); @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 getConversionActionTest() { com.google.ads.googleads.v5.services.ConversionActionName resourceName2 = com.google.ads.googleads.v5.services.ConversionActionName.of( "[CUSTOMER]", "[CONVERSION_ACTION]"); long id = 3355L; com.google.ads.googleads.v5.services.ConversionActionName name = com.google.ads.googleads.v5.services.ConversionActionName.of( "[CUSTOMER]", "[CONVERSION_ACTION]"); String ownerCustomer = "ownerCustomer-857925654"; boolean includeInConversionsMetric = false; long clickThroughLookbackWindowDays = 1040290530L; long viewThroughLookbackWindowDays = 990677281L; long phoneCallDurationSeconds = 917713540L; String appId = "appId-1411074055"; ConversionAction expectedResponse = ConversionAction.newBuilder() .setResourceName(resourceName2.toString()) .setId(id) .setName(name.toString()) .setOwnerCustomer(ownerCustomer) .setIncludeInConversionsMetric(includeInConversionsMetric) .setClickThroughLookbackWindowDays(clickThroughLookbackWindowDays) .setViewThroughLookbackWindowDays(viewThroughLookbackWindowDays) .setPhoneCallDurationSeconds(phoneCallDurationSeconds) .setAppId(appId) .build(); mockConversionActionService.addResponse(expectedResponse); ConversionActionName resourceName = ConversionActionName.of("[CUSTOMER]", "[CONVERSION_ACTION]"); ConversionAction actualResponse = client.getConversionAction(resourceName); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockConversionActionService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetConversionActionRequest actualRequest = (GetConversionActionRequest) actualRequests.get(0); Assert.assertEquals(resourceName, ConversionActionName.parse(actualRequest.getResourceName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void getConversionActionExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockConversionActionService.addException(exception); try { ConversionActionName resourceName = ConversionActionName.of("[CUSTOMER]", "[CONVERSION_ACTION]"); client.getConversionAction(resourceName); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }