### Question:
GsonMessageBodyReaderWriter implements MessageBodyReader<Object>, MessageBodyWriter<Object> { @Override public Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream inputStream) throws IOException { JsonReader reader = new JsonReader(new InputStreamReader(inputStream, Charset.forName(UTF_8))); Object obj = gson.fromJson(reader, type); reader.close(); return obj; } 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 testReadFrom() throws IOException { Object obj = provider.readFrom((Class<Object>) MOCK.getClass(), MOCK.getClass(), new Annotation[]{}, MediaType.APPLICATION_JSON_TYPE, MAP, IS); assertEquals(new Gson().fromJson(MOCK_OBJECT_JSON, MockObject.class), obj); }
@Test(expected = JsonParseException.class) public void testReadFromThrowsJsonParseException() throws IOException { provider.readFrom((Class<Object>) MOCK.getClass(), MOCK.getClass(), new Annotation[]{}, MediaType.APPLICATION_JSON_TYPE, MAP, new ByteArrayInputStream(INCORRECT_MOCK_OBJECT_JSON.getBytes())); }