// Calculate hash data for object.
byte[] md5Hash = ServiceUtils.computeMD5Hash(dataString.getBytes());
// Ensure that using an invalid hash value fails.
try {
object.addMetadata("Content-MD5", "123");
s3Service.putObject(bucket, object);
fail("Should have failed due to invalid hash value");
} catch (S3ServiceException e) {
// This error check would be nice to have, but it only works for the REST interface, not SOAP.
// assertEquals("Expected error code indicating invalid md5 hash", "InvalidDigest", e.getErrorCode());