@VisibleForTesting
  CopyObjectResponse atomicCopy(
      S3ResourceId sourcePath, S3ResourceId destinationPath, HeadObjectResponse objectHead)
      throws SdkServiceException {
    CopyObjectRequest copyObjectRequest =
        CopyObjectRequest.builder()
            .sourceBucket(sourcePath.getBucket())
            .sourceKey(sourcePath.getKey())
            .destinationBucket(destinationPath.getBucket())
            .destinationKey(destinationPath.getKey())
            .metadata(objectHead.metadata())
            .storageClass(config.getS3StorageClass())
            .serverSideEncryption(config.getSSEAlgorithm())
            .ssekmsKeyId(config.getSSEKMSKeyId())
            .sseCustomerKey(config.getSSECustomerKey().getKey())
            .sseCustomerAlgorithm(config.getSSECustomerKey().getAlgorithm())
            .copySourceSSECustomerKey(config.getSSECustomerKey().getKey())
            .copySourceSSECustomerAlgorithm(config.getSSECustomerKey().getAlgorithm())
            .sseCustomerKeyMD5(config.getSSECustomerKey().getMD5())
            .copySourceSSECustomerKeyMD5(config.getSSECustomerKey().getMD5())
            .build();
    return s3Client.get().copyObject(copyObjectRequest);
  }
@Test
  public void testAtomicCopy() throws IOException {
    testAtomicCopy(s3Config("s3"));
    testAtomicCopy(s3Config("other"));
    testAtomicCopy(s3ConfigWithSSECustomerKey("s3"));
    testAtomicCopy(s3ConfigWithSSECustomerKey("other"));
  }