Source:
public static void getDefaultRetention_test() throws Exception { if (!mintEnv) { System.out.println("Test: getDefaultRetention(String bucketName)"); } long startTime = System.currentTimeMillis(); String bucketName = getRandomName(); try { client.makeBucket(bucketName, null, true); ObjectLockConfiguration expectedConfig = new ObjectLockConfiguration(RetentionMode.COMPLIANCE, new RetentionDurationDays(10)); client.setDefaultRetention(bucketName, expectedConfig); ObjectLockConfiguration config = client.getDefaultRetention(bucketName); if (!(config.duration().unit() == expectedConfig.duration().unit() && config.duration().duration() == expectedConfig.duration().duration())) { System.out.println( "FAILED. expected mode : " + RetentionMode.COMPLIANCE + ", got: " + config.mode() + " expected duration : " + expectedConfig.duration() + ", got: " + config.duration()); mintFailedLog( "getDefaultRetention", "(String bucketName)", startTime, "FAILED" + " >>> ", "expected mode : " + RetentionMode.COMPLIANCE + ", got: " + config.mode() + " expected duration : " + expectedConfig.duration() + ", got: " + config.duration()); } mintSuccessLog("getDefaultRetention (String bucketName)", 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("getDefaultRetention (String bucketName)", null, startTime); } else { mintFailedLog( "getDefaultRetention (String bucketName)", null, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } } finally { client.removeBucket(bucketName); } }

Target:
public static void getDefaultRetention_test() throws Exception { if (!mintEnv) { System.out.println("Test: getDefaultRetention(String bucketName)"); } long startTime = System.currentTimeMillis(); String bucketName = getRandomName(); try { client.makeBucket(bucketName, null, true); try { ObjectLockConfiguration expectedConfig = new ObjectLockConfiguration(RetentionMode.COMPLIANCE, new RetentionDurationDays(10)); client.setDefaultRetention(bucketName, expectedConfig); ObjectLockConfiguration config = client.getDefaultRetention(bucketName); if ((!(config.duration().unit() == expectedConfig.duration().unit() && config.duration().duration() == expectedConfig.duration().duration())) || (config.mode() != expectedConfig.mode())) { throw new Exception( "[FAILED] Expected: expected duration : " + expectedConfig.duration() + ", got: " + config.duration() + " expected mode :" + expectedConfig.mode() + ", got: " + config.mode()); } expectedConfig = new ObjectLockConfiguration(RetentionMode.GOVERNANCE, new RetentionDurationYears(1)); client.setDefaultRetention(bucketName, expectedConfig); config = client.getDefaultRetention(bucketName); if ((!(config.duration().unit() == expectedConfig.duration().unit() && config.duration().duration() == expectedConfig.duration().duration())) || (config.mode() != expectedConfig.mode())) { throw new Exception( "[FAILED] Expected: expected duration : " + expectedConfig.duration() + ", got: " + config.duration() + " expected mode :" + expectedConfig.mode() + ", got: " + config.mode()); } } finally { client.removeBucket(bucketName); } mintSuccessLog("getDefaultRetention (String bucketName)", 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("getDefaultRetention (String bucketName)", null, startTime); } else { mintFailedLog( "getDefaultRetention (String bucketName)", null, startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace())); throw e; } } }