Source:
<code>public static void testCopyObject( String testTags, ServerSideEncryption sse, CopyObjectArgs args, boolean negativeCase) throws Exception { String methodName = "copyObject()"; if (!mintEnv) { System.out.println("Test: " + methodName + " " + testTags); } <START> String srcObject = args.object(); if (args.srcObject() != null) { srcObject = args.srcObject(); <END> } long startTime = System.currentTimeMillis(); try { client.makeBucket(MakeBucketArgs.builder().bucket(args.srcBucket()).build()); try { PutObjectOptions options = new PutObjectOptions(1 * KB, -1); if (sse != null) { options.setSse(sse); } client.putObject(args.srcBucket(), srcObject, new ContentInputStream(1 * KB), options); if (negativeCase) { try { client.copyObject(args); } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.PRECONDITION_FAILED) { throw e; } } } else { client.copyObject(args); ServerSideEncryptionCustomerKey ssec = null; if (sse instanceof ServerSideEncryptionCustomerKey) { ssec = (ServerSideEncryptionCustomerKey) sse; } client.statObject( StatObjectArgs.builder() .bucket(args.bucket()) .object(args.object()) .ssec(ssec) .build()); } mintSuccessLog(methodName, testTags, startTime); } finally { client.removeObject( RemoveObjectArgs.builder().bucket(args.srcBucket()).object(srcObject).build()); client.removeObject( RemoveObjectArgs.builder().bucket(args.bucket()).object(args.object()).build()); client.removeBucket(RemoveBucketArgs.builder().bucket(args.srcBucket()).build()); } } catch (Exception e) { handleException(methodName, testTags, startTime, e); } }</code><technical_language>simplified Optional class follows: String srcObject = Optional.ofNullable(args.srcObject()).orElse(args.object());</technical_language>

Target:
public static void testCopyObject( String testTags, ServerSideEncryption sse, CopyObjectArgs args, boolean negativeCase) throws Exception { String methodName = "copyObject()"; if (!mintEnv) { System.out.println("Test: " + methodName + " " + testTags); } String srcObject = Optional.ofNullable(args.srcObject()).orElse(args.object()); long startTime = System.currentTimeMillis(); try { client.makeBucket(MakeBucketArgs.builder().bucket(args.srcBucket()).build()); try { PutObjectOptions options = new PutObjectOptions(1 * KB, -1); if (sse != null) { options.setSse(sse); } client.putObject(args.srcBucket(), srcObject, new ContentInputStream(1 * KB), options); if (negativeCase) { try { client.copyObject(args); } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.PRECONDITION_FAILED) { throw e; } } } else { client.copyObject(args); ServerSideEncryptionCustomerKey ssec = null; if (sse instanceof ServerSideEncryptionCustomerKey) { ssec = (ServerSideEncryptionCustomerKey) sse; } client.statObject( StatObjectArgs.builder() .bucket(args.bucket()) .object(args.object()) .ssec(ssec) .build()); } mintSuccessLog(methodName, testTags, startTime); } finally { client.removeObject( RemoveObjectArgs.builder().bucket(args.srcBucket()).object(srcObject).build()); client.removeObject( RemoveObjectArgs.builder().bucket(args.bucket()).object(args.object()).build()); client.removeBucket(RemoveBucketArgs.builder().bucket(args.srcBucket()).build()); } } catch (Exception e) { handleException(methodName, testTags, startTime, e); } }