Source:
<code>public void postGetHeadDeleteTest() throws Exception { final int CONTENT_LENGTH = 1024; ByteBuffer content = ByteBuffer.wrap(RestTestUtils.getRandomBytes(CONTENT_LENGTH)); String serviceId = "postGetHeadDeleteServiceID"; String contentType = "application/octet-stream"; String ownerId = "postGetHeadDeleteOwnerID"; JSONObject headers = new JSONObject(); setAmbryHeaders(headers, CONTENT_LENGTH, 7200, false, serviceId, contentType, ownerId); Map<String, String> userMetadata = new HashMap<String, String>(); userMetadata.put(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key1", "value1"); userMetadata.put(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key2", "value2"); RestUtilsTest.setUserMetadataHeaders(headers, userMetadata); String blobId = postBlobAndVerify(headers, content); getBlobAndVerify(blobId, null, headers, content); ByteRange range = ByteRange.fromStartOffset(ThreadLocalRandom.current().nextLong(CONTENT_LENGTH)); <START> getBlobAndVerify(blobId, range, headers, content); <END> range = ByteRange.fromLastNBytes(ThreadLocalRandom.current().nextLong(CONTENT_LENGTH + 1)); headers.put(RestUtils.Headers.CONTENT_RANGE, RestUtils.buildContentRangeHeader(range.toResolvedByteRange(CONTENT_LENGTH), CONTENT_LENGTH)); getBlobAndVerify(blobId, range, headers, content); long random1 = ThreadLocalRandom.current().nextLong(CONTENT_LENGTH); long random2 = ThreadLocalRandom.current().nextLong(CONTENT_LENGTH); range = ByteRange.fromOffsetRange(Math.min(random1, random2), Math.max(random1, random2)); headers.put(RestUtils.Headers.CONTENT_RANGE, RestUtils.buildContentRangeHeader(range.toResolvedByteRange(CONTENT_LENGTH), CONTENT_LENGTH)); getBlobAndVerify(blobId, range, headers, content); getNotModifiedBlobAndVerify(blobId); getUserMetadataAndVerify(blobId, headers); getBlobInfoAndVerify(blobId, headers); getHeadAndVerify(blobId, headers); deleteBlobAndVerify(blobId); verifyOperationsAfterDelete(blobId); }</code><technical_language>need set expect in response headers</technical_language>

Target:
public void postGetHeadDeleteTest() throws Exception { final int CONTENT_LENGTH = 1024; ByteBuffer content = ByteBuffer.wrap(RestTestUtils.getRandomBytes(CONTENT_LENGTH)); String serviceId = "postGetHeadDeleteServiceID"; String contentType = "application/octet-stream"; String ownerId = "postGetHeadDeleteOwnerID"; JSONObject headers = new JSONObject(); setAmbryHeaders(headers, CONTENT_LENGTH, 7200, false, serviceId, contentType, ownerId); Map<String, String> userMetadata = new HashMap<String, String>(); userMetadata.put(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key1", "value1"); userMetadata.put(RestUtils.Headers.USER_META_DATA_HEADER_PREFIX + "key2", "value2"); RestUtilsTest.setUserMetadataHeaders(headers, userMetadata); String blobId = postBlobAndVerify(headers, content); getBlobAndVerify(blobId, null, headers, content); getHeadAndVerify(blobId, null, headers); ByteRange range = ByteRange.fromStartOffset(ThreadLocalRandom.current().nextLong(CONTENT_LENGTH)); getBlobAndVerify(blobId, range, headers, content); getHeadAndVerify(blobId, range, headers); range = ByteRange.fromLastNBytes(ThreadLocalRandom.current().nextLong(CONTENT_LENGTH + 1)); getBlobAndVerify(blobId, range, headers, content); getHeadAndVerify(blobId, range, headers); long random1 = ThreadLocalRandom.current().nextLong(CONTENT_LENGTH); long random2 = ThreadLocalRandom.current().nextLong(CONTENT_LENGTH); range = ByteRange.fromOffsetRange(Math.min(random1, random2), Math.max(random1, random2)); getBlobAndVerify(blobId, range, headers, content); getHeadAndVerify(blobId, range, headers); getNotModifiedBlobAndVerify(blobId); getUserMetadataAndVerify(blobId, headers); getBlobInfoAndVerify(blobId, headers); deleteBlobAndVerify(blobId); verifyOperationsAfterDelete(blobId); }