ConversionUploadServiceClient implements BackgroundResource { public final UploadCallConversionsResponse uploadCallConversions( String customerId, List<CallConversion> conversions, boolean partialFailure) { UploadCallConversionsRequest request = UploadCallConversionsRequest.newBuilder() .setCustomerId(customerId) .addAllConversions(conversions) .setPartialFailure(partialFailure) .build(); return uploadCallConversions(request); } protected  ConversionUploadServiceClient(ConversionUploadServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected  ConversionUploadServiceClient(ConversionUploadServiceStub stub); static final ConversionUploadServiceClient create(); static final ConversionUploadServiceClient create(ConversionUploadServiceSettings settings); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") static final ConversionUploadServiceClient create(ConversionUploadServiceStub stub); final ConversionUploadServiceSettings getSettings(); @BetaApi("A restructuring of stub classes is planned, so this may break in the future") ConversionUploadServiceStub getStub(); final UploadClickConversionsResponse uploadClickConversions(
      String customerId, List<ClickConversion> conversions, boolean partialFailure); final UploadClickConversionsResponse uploadClickConversions(
      UploadClickConversionsRequest request); final UnaryCallable<UploadClickConversionsRequest, UploadClickConversionsResponse> uploadClickConversionsCallable(); final UploadCallConversionsResponse uploadCallConversions(
      String customerId, List<CallConversion> conversions, boolean partialFailure); final UploadCallConversionsResponse uploadCallConversions(
      UploadCallConversionsRequest request); final UnaryCallable<UploadCallConversionsRequest, UploadCallConversionsResponse> uploadCallConversionsCallable(); @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 uploadCallConversionsTest() { UploadCallConversionsResponse expectedResponse = UploadCallConversionsResponse.newBuilder().build(); mockConversionUploadService.addResponse(expectedResponse); String customerId = "customerId-1772061412"; List<CallConversion> conversions = new ArrayList<>(); boolean partialFailure = true; UploadCallConversionsResponse actualResponse = client.uploadCallConversions(customerId, conversions, partialFailure); Assert.assertEquals(expectedResponse, actualResponse); List<AbstractMessage> actualRequests = mockConversionUploadService.getRequests(); Assert.assertEquals(1, actualRequests.size()); UploadCallConversionsRequest actualRequest = (UploadCallConversionsRequest) actualRequests.get(0); Assert.assertEquals(customerId, actualRequest.getCustomerId()); Assert.assertEquals(conversions, actualRequest.getConversionsList()); Assert.assertEquals(partialFailure, actualRequest.getPartialFailure()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Test @SuppressWarnings("all") public void uploadCallConversionsExceptionTest() throws Exception { StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); mockConversionUploadService.addException(exception); try { String customerId = "customerId-1772061412"; List<CallConversion> conversions = new ArrayList<>(); boolean partialFailure = true; client.uploadCallConversions(customerId, conversions, partialFailure); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { } }