Source:
public static void copyObject_test12() throws Exception { if (!mintEnv) { System.out.println("Test: copyObject(String bucketName, String objectName, ServerSideEncryption sseSource, " + "String destBucketName, CopyConditions copyConditions, ServerSideEncryption sseTarget)" + " using SSE_KMS. "); } long startTime = System.currentTimeMillis(); try { String objectName = getRandomName(); Map<String, String> myContext = new HashMap<>(); myContext.put("key1", "value1"); String keyId = ""; keyId = System.getenv("MINT_KEY_ID"); if (keyId.equals("")) { mintIgnoredLog("getBucketPolicy(String bucketName)", null, startTime); } ServerSideEncryption sse = ServerSideEncryption.withManagedKeys("keyId", myContext); try (final InputStream is = new ContentInputStream(1)) { client.putObject(bucketName, objectName, new BufferedInputStream(is), Long.valueOf(1), null, sse, null); } CopyConditions copyConditions = new CopyConditions(); copyConditions.setReplaceMetadataDirective(); client.copyObject(bucketName, objectName, null, bucketName, objectName, copyConditions, sse); ObjectStat objectStat = client.statObject(bucketName, objectName); if (objectStat.httpHeaders().containsKey("X-Amz-Meta-Test")) { throw new Exception("expected user-defined metadata has been removed"); } client.removeObject(bucketName, objectName); mintSuccessLog("copyObject(String bucketName, String objectName, ServerSideEncryption sseSource, " + "String destBucketName, CopyConditions copyConditions, ServerSideEncryption sseTarget)" + " using SSE_KMS.", null, startTime); } catch (Exception e) { mintFailedLog("copyObject(String bucketName, String objectName, ServerSideEncryption sseSource, " + "String destBucketName, CopyConditions copyConditions, ServerSideEncryption sseTarget)" + " using SSE_KMS.", null, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } }

Target:
public static void copyObject_test12() throws Exception { if (!mintEnv) { System.out.println("Test: copyObject(String bucketName, String objectName, ServerSideEncryption sseSource, " + "String destBucketName, CopyConditions copyConditions, ServerSideEncryption sseTarget)" + " using SSE_KMS. "); } long startTime = System.currentTimeMillis(); try { String objectName = getRandomName(); Map<String, String> myContext = new HashMap<>(); myContext.put("key1", "value1"); String keyId = ""; keyId = System.getenv("MINT_KEY_ID"); if (keyId.equals("")) { mintIgnoredLog("getBucketPolicy(String bucketName)", null, startTime); } ServerSideEncryption sse = ServerSideEncryption.withManagedKeys("keyId", myContext); try (final InputStream is = new ContentInputStream(1)) { client.putObject(bucketName, objectName, is, 1L, null, sse, null); } CopyConditions copyConditions = new CopyConditions(); copyConditions.setReplaceMetadataDirective(); client.copyObject(bucketName, objectName, null, bucketName, objectName, copyConditions, sse); ObjectStat objectStat = client.statObject(bucketName, objectName); if (objectStat.httpHeaders().containsKey("X-Amz-Meta-Test")) { throw new Exception("expected user-defined metadata has been removed"); } client.removeObject(bucketName, objectName); mintSuccessLog("copyObject(String bucketName, String objectName, ServerSideEncryption sseSource, " + "String destBucketName, CopyConditions copyConditions, ServerSideEncryption sseTarget)" + " using SSE_KMS.", null, startTime); } catch (Exception e) { mintFailedLog("copyObject(String bucketName, String objectName, ServerSideEncryption sseSource, " + "String destBucketName, CopyConditions copyConditions, ServerSideEncryption sseTarget)" + " using SSE_KMS.", null, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } }