### Question:
ParseSystemAndUserMetadataFromHeaders implements Function<HttpResponse, MutableBlobMetadata>,
         InvocationContext<ParseSystemAndUserMetadataFromHeaders> { public MutableBlobMetadata apply(HttpResponse from) { checkNotNull(from, "request"); checkState(name != null, "name must be initialized by now"); MutableBlobMetadata to = metadataFactory.get(); to.setName(name); to.setUri(endpoint); if (from.getPayload() != null) HttpUtils.copy(from.getPayload().getContentMetadata(), to.getContentMetadata()); addETagTo(from, to); parseLastModifiedOrThrowException(from, to); addUserMetadataTo(from, to); return to; } @Inject  ParseSystemAndUserMetadataFromHeaders(Provider<MutableBlobMetadata> metadataFactory, DateService dateParser,
            @Named(PROPERTY_USER_METADATA_PREFIX) String metadataPrefix); MutableBlobMetadata apply(HttpResponse from); ParseSystemAndUserMetadataFromHeaders setContext(HttpRequest request); ParseSystemAndUserMetadataFromHeaders setName(String name);  }### Answer:
@Test public void testApplySetsName() { HttpResponse from = HttpResponse.builder() .statusCode(200).message("ok") .payload("") .addHeader(HttpHeaders.LAST_MODIFIED, "Wed, 09 Sep 2009 19:50:23 GMT").build(); from.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON); from.getPayload().getContentMetadata().setContentLength(100L); BlobMetadata metadata = parser.apply(from); assertEquals(metadata.getName(), "key"); }
@Test public void testApplySetsName() { HttpResponse from = HttpResponse.builder() .statusCode(200).message("ok") .payload("") .addHeader(HttpHeaders.LAST_MODIFIED, "Wed, 09 Sep 2009 19:50:23 GMT").build(); from.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON); from.getPayload().getContentMetadata().setContentLength(100l); BlobMetadata metadata = parser.apply(from); assertEquals(metadata.getName(), "key"); }
@Test public void testNoContentOn204IsOk() { HttpResponse from = HttpResponse.builder() .statusCode(204).message("ok") .addHeader(HttpHeaders.LAST_MODIFIED, "Wed, 09 Sep 2009 19:50:23 GMT").build(); parser.apply(from); }