Source:
public static void disableObjectLegalHold_test() throws Exception { if (!mintEnv) { System.out.println( "Test: disableObjectLegalHold(String bucketName, String objectName, String versionId)"); } long startTime = System.currentTimeMillis(); String bucketName = getRandomName(); String objectName = getRandomName(); try { client.makeBucket(bucketName, null, true); try (final InputStream is = new ContentInputStream(1 * KB)) { client.putObject(bucketName, objectName, is, new PutObjectOptions(1 * KB, -1)); } client.enableObjectLegalHold(bucketName, objectName, ""); client.disableObjectLegalHold(bucketName, objectName, ""); if (client.isObjectLegalHoldEnabled(bucketName, objectName, "")) { if (client.isObjectLegalHoldEnabled(bucketName, objectName, "")) { System.out.println( "FAILED. expected Object Legal Hold Enabled to be : " + "False" + ", got: True"); } mintFailedLog( "disableObjectLegalHold", "(String bucketName, String objectName, String versionId)", startTime, "FAILED" + " >>> ", " expected Object Legal Hold Enabled to be : " + "False" + ", got: True"); } try (final InputStream is = new ContentInputStream(1 * KB)) { client.putObject(bucketName, objectName, is, new PutObjectOptions(1 * KB, -1)); } mintSuccessLog( "disableObjectLegalHold(String bucketName, String objectName, String versionId)", null, startTime); } catch (Exception e) { ErrorResponse errorResponse = null; if (e instanceof ErrorResponseException) { ErrorResponseException exp = (ErrorResponseException) e; errorResponse = exp.errorResponse(); } if (errorResponse != null && errorResponse.errorCode() == ErrorCode.NOT_IMPLEMENTED) { mintIgnoredLog( "disableObjectLegalHold(String bucketName, String objectName, String versionId)", null, startTime); } else { mintFailedLog( "disableObjectLegalHold(String bucketName, String objectName, String versionId)", null, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } } finally { client.removeObject(bucketName, objectName); client.removeBucket(bucketName); } }

Target:
public static void disableObjectLegalHold_test() throws Exception { if (!mintEnv) { System.out.println( "Test: disableObjectLegalHold(String bucketName, String objectName, String versionId)"); } long startTime = System.currentTimeMillis(); String bucketName = getRandomName(); String objectName = getRandomName(); try { client.makeBucket(bucketName, null, true); try { try (final InputStream is = new ContentInputStream(1 * KB)) { client.putObject(bucketName, objectName, is, new PutObjectOptions(1 * KB, -1)); } client.enableObjectLegalHold(bucketName, objectName, null); client.disableObjectLegalHold(bucketName, objectName, null); if (client.isObjectLegalHoldEnabled(bucketName, objectName, null)) { throw new Exception("[FAILED] isObjectLegalHoldEnabled(): expected: false, got: true"); } } finally { client.removeObject(bucketName, objectName); client.removeBucket(bucketName); } mintSuccessLog( "disableObjectLegalHold(String bucketName, String objectName, String versionId)", null, startTime); } catch (Exception e) { ErrorResponse errorResponse = null; if (e instanceof ErrorResponseException) { ErrorResponseException exp = (ErrorResponseException) e; errorResponse = exp.errorResponse(); } if (errorResponse != null && errorResponse.errorCode() == ErrorCode.NOT_IMPLEMENTED) { mintIgnoredLog( "disableObjectLegalHold(String bucketName, String objectName, String versionId)", null, startTime); } else { mintFailedLog( "disableObjectLegalHold(String bucketName, String objectName, String versionId)", null, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } } }