### Question:
GsonMessageBodyReaderWriter implements MessageBodyReader<Object>, MessageBodyWriter<Object> { @Override public void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream) throws IOException { JsonWriter writer = new JsonWriter(new OutputStreamWriter(outputStream, Charset.forName(UTF_8))); gson.toJson(src, type, writer); writer.close(); } GsonMessageBodyReaderWriter(); @Override boolean isReadable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream inputStream); @Override boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override long getSize(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType); @Override void writeTo(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream outputStream);  }### Answer:
@Test public void testWriteTo() throws IOException { provider.writeTo(MOCK_OBJECT, MOCK_OBJECT.getClass(), MOCK_OBJECT.getClass(), new Annotation[]{}, MediaType.APPLICATION_JSON_TYPE, MAP, OS); assertEquals(MOCK_OBJECT_JSON, new String(OS.toByteArray())); }