@Test
 public void cannotProvideStreamingForOtherMediaTypes() throws Exception {
   final Response.ResponseBuilder responseBuilder = mock(Response.ResponseBuilder.class);
   // no streaming
   when(responseBuilder.entity(anyString())).thenReturn(responseBuilder);
   Mockito.verify(responseBuilder, never()).entity(isA(StreamingOutput.class));
   when(responseBuilder.type(Matchers.<MediaType>any())).thenReturn(responseBuilder);
   when(responseBuilder.build()).thenReturn(null);
   OutputFormat format =
       repository.outputFormat(
           asList(MediaType.TEXT_HTML_TYPE), new URI("http://some.host"), streamingHeader());
   assertNotNull(format);
   format.response(responseBuilder, new ExceptionRepresentation(new RuntimeException()));
 }
 @Test
 public void canProvideStreamingJsonOutputFormat() throws Exception {
   Response response = mock(Response.class);
   final AtomicReference<StreamingOutput> ref = new AtomicReference<>();
   final Response.ResponseBuilder responseBuilder = mockResponsBuilder(response, ref);
   OutputFormat format =
       repository.outputFormat(asList(MediaType.APPLICATION_JSON_TYPE), null, streamingHeader());
   assertNotNull(format);
   Response returnedResponse =
       format.response(responseBuilder, new MapRepresentation(map("a", "test")));
   assertSame(response, returnedResponse);
   StreamingOutput streamingOutput = ref.get();
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   streamingOutput.write(baos);
   assertEquals("{\"a\":\"test\"}", baos.toString());
 }