StreamResource extends AbstractStreamResource { public StreamResource setContentTypeResolver(ContentTypeResolver resolver) { if (resolver == null) { throw new IllegalArgumentException("Resolver cannot be null"); } this.resolver = resolver; return this; } StreamResource(String name, StreamResourceWriter writer);  StreamResource(String name, InputStreamFactory factory); StreamResourceWriter getWriter(); StreamResource setContentTypeResolver(ContentTypeResolver resolver); StreamResource setContentType(String contentType); ContentTypeResolver getContentTypeResolver(); @Override String getName();  }
@Test public void setContentTypeResolver() { StreamResource resource = new StreamResource("foo", () -> makeEmptyStream()); resource.setContentTypeResolver((res, context) -> "bar"); Assert.assertNotNull(resource.getContentTypeResolver()); assertContentType(resource, resource.getContentTypeResolver()); }