@SuppressWarnings("unchecked")
@Test
public void readsContentOfEntityStreamAsMultivaluedMap() throws Exception {

    MultivaluedMap<String, String> multivaluedMap = multivaluedMapEntityProvider.readFrom((Class)MultivaluedMap.class, multiValuedMapGenericType,
                                                                                          null, APPLICATION_FORM_URLENCODED_TYPE,
                                                                                          new MultivaluedMapImpl(),
                                                                                          new ByteArrayInputStream(testContent));
    Map<String, List<String>> decodedMap = ImmutableMap.of("foo", newArrayList("to be or not to be"), "bar", newArrayList("hello world"));
    Map<String, List<String>> encodedMap = ImmutableMap.of("foo", newArrayList("to%20be%20or%20not%20to%20be"), "bar", newArrayList("hello%20world"));
    assertEquals(decodedMap, multivaluedMap);
    ArgumentCaptor<Object> argumentCaptor = ArgumentCaptor.forClass(Object.class);
    verify(context.getAttributes()).put(eq("org.everrest.provider.entity.decoded.form"), argumentCaptor.capture());
    assertEquals(decodedMap, argumentCaptor.getValue());
    verify(context.getAttributes()).put(eq("org.everrest.provider.entity.encoded.form"), argumentCaptor.capture());
    assertEquals(encodedMap, argumentCaptor.getValue());
}