Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void canProvideStreamingJsonOutputFormat() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CanProvideStreamingJsonOutputFormat()
        {
            Response response = mock(typeof(Response));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicReference<javax.ws.rs.core.StreamingOutput> ref = new java.util.concurrent.atomic.AtomicReference<>();
            AtomicReference <StreamingOutput> @ref = new AtomicReference <StreamingOutput>();

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final javax.ws.rs.core.Response.ResponseBuilder responseBuilder = mockResponseBuilder(response, ref);
            Response.ResponseBuilder responseBuilder = MockResponseBuilder(response, @ref);
            OutputFormat             format          = _repository.outputFormat(new IList <MediaType> {
                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();
            MemoryStream    baos            = new MemoryStream();

            streamingOutput.write(baos);
            assertEquals("{\"a\":\"test\"}", baos.ToString());
        }