### Question:
CopyObjectOptions extends BaseHttpRequestOptions { @Override public Multimap<String, String> buildRequestHeaders() { checkState(headerTag != null, "headerTag should have been injected!"); checkState(metadataPrefix != null, "metadataPrefix should have been injected!"); ImmutableMultimap.Builder<String, String> returnVal = ImmutableMultimap.builder(); for (Entry<String, String> entry : headers.entries()) { returnVal.put(entry.getKey().replace(DEFAULT_AMAZON_HEADERTAG, headerTag), entry.getValue()); } boolean replace = false; if (cacheControl != null) { returnVal.put(HttpHeaders.CACHE_CONTROL, cacheControl); replace = true; } if (contentDisposition != null) { returnVal.put(HttpHeaders.CONTENT_DISPOSITION, contentDisposition); replace = true; } if (contentEncoding != null) { returnVal.put(HttpHeaders.CONTENT_ENCODING, contentEncoding); replace = true; } if (contentLanguage != null) { returnVal.put(HttpHeaders.CONTENT_LANGUAGE, contentLanguage); replace = true; } if (contentType != null) { returnVal.put(HttpHeaders.CONTENT_TYPE, contentType); replace = true; } if (metadata != null) { for (Map.Entry<String, String> entry : metadata.entrySet()) { String key = entry.getKey(); returnVal.put(key.startsWith(metadataPrefix) ? key : metadataPrefix + key, entry.getValue()); } replace = true; } if (replace) { returnVal.put(METADATA_DIRECTIVE.replace(DEFAULT_AMAZON_HEADERTAG, headerTag), "REPLACE"); } return returnVal.build(); }  @Inject void setMetadataPrefix(@Named(PROPERTY_USER_METADATA_PREFIX) String metadataPrefix); @Inject void setHeaderTag(@Named(PROPERTY_HEADER_TAG) String headerTag); CopyObjectOptions overrideAcl(CannedAccessPolicy acl); CannedAccessPolicy getAcl(); String getIfModifiedSince(); String getIfUnmodifiedSince(); String getIfMatch(); String getIfNoneMatch(); Map<String, String> getMetadata(); CopyObjectOptions ifSourceModifiedSince(Date ifModifiedSince); CopyObjectOptions ifSourceUnmodifiedSince(Date ifUnmodifiedSince); CopyObjectOptions ifSourceETagMatches(String eTag); CopyObjectOptions ifSourceETagDoesntMatch(String eTag); @Override Multimap<String, String> buildRequestHeaders(); CopyObjectOptions cacheControl(String cacheControl); CopyObjectOptions contentDisposition(String contentDisposition); CopyObjectOptions contentEncoding(String contentEncoding); CopyObjectOptions contentLanguage(String contentLanguage); CopyObjectOptions contentType(String contentType); CopyObjectOptions overrideMetadataWith(Map<String, String> metadata); static final CopyObjectOptions NONE; }### Answer:
@Test void testBuildRequestHeaders() { CopyObjectOptions options = ifSourceModifiedSince(now).ifSourceETagDoesntMatch(etag).overrideMetadataWith( goodMeta); options.setHeaderTag(DEFAULT_AMAZON_HEADERTAG); options.setMetadataPrefix(USER_METADATA_PREFIX); Multimap<String, String> headers = options.buildRequestHeaders(); assertEquals(getOnlyElement(headers.get(COPY_SOURCE_IF_MODIFIED_SINCE)), new SimpleDateFormatDateService() .rfc822DateFormat(now)); assertEquals(getOnlyElement(headers.get(COPY_SOURCE_IF_NO_MATCH)), "\"" + etag + "\""); for (String value : goodMeta.values()) assertTrue(headers.containsValue(value)); }