test_class.declarator: multiValuedMapGenericType = newParameterizedType(MultivaluedMap.class, String.class, String.class)
test_class.modifier: private final
test_class.original_string: private final ParameterizedType multiValuedMapGenericType = newParameterizedType(MultivaluedMap.class, String.class, String.class);
test_class.type: ParameterizedType
test_class.var_name: multiValuedMapGenericType
test_class.declarator: testContent
test_class.modifier: private
test_class.original_string: private byte[] testContent;
test_class.type: byte[]
test_class.var_name: testContent
test_class.declarator: context
test_class.modifier: private
test_class.original_string: private ApplicationContext           context;
test_class.type: ApplicationContext
test_class.var_name: context
test_class.declarator: servletRequest
test_class.modifier: private
test_class.original_string: private HttpServletRequest           servletRequest;
test_class.type: HttpServletRequest
test_class.var_name: servletRequest
test_class.declarator: multivaluedMapEntityProvider
test_class.modifier: private
test_class.original_string: private MultivaluedMapEntityProvider multivaluedMapEntityProvider;
test_class.type: MultivaluedMapEntityProvider
test_class.var_name: multivaluedMapEntityProvider
test_class.file: everrest-core/src/test/java/org/everrest/core/impl/provider/MultivaluedMapEntityProviderTest.java
test_class.identifier: MultivaluedMapEntityProviderTest
test_case.body: @SuppressWarnings("unchecked")
      @Test
      public void getsParametersFromServletRequestWhenEntityStreamIsEmpty() throws Exception {
          Map<String, String[]> parameterMap = ImmutableMap.of("foo", new String[]{"to be or not to be"}, "bar", new String[]{"hello world"});
          when(servletRequest.getParameterMap()).thenReturn(parameterMap);
  
          MultivaluedMap<String, String> multivaluedMap = multivaluedMapEntityProvider.readFrom((Class)MultivaluedMap.class, multiValuedMapGenericType,
                                                                                                null, APPLICATION_FORM_URLENCODED_TYPE,
                                                                                                new MultivaluedMapImpl(),
                                                                                                new EmptyInputStream());
  
          Map<String, List<String>> decodedMap = ImmutableMap.of("foo", newArrayList("to be or not to be"), "bar", newArrayList("hello world"));
  
          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());
          assertTrue(((MultivaluedMap)argumentCaptor.getValue()).isEmpty());
      }
test_case.class_method_signature: MultivaluedMapEntityProviderTest.getsParametersFromServletRequestWhenEntityStreamIsEmpty()
test_case.full_signature: @SuppressWarnings("unchecked") @Test public void getsParametersFromServletRequestWhenEntityStreamIsEmpty()
test_case.identifier: getsParametersFromServletRequestWhenEntityStreamIsEmpty
test_case.invocations: of thenReturn when getParameterMap readFrom of newArrayList newArrayList assertEquals forClass put verify getAttributes eq capture assertEquals getValue put verify getAttributes eq capture assertTrue isEmpty getValue
test_case.modifiers: @SuppressWarnings("unchecked") @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getsParametersFromServletRequestWhenEntityStreamIsEmpty()
focal_class.declarator: httpRequest
focal_class.modifier: private
focal_class.original_string: private HttpServletRequest httpRequest;
focal_class.type: HttpServletRequest
focal_class.var_name: httpRequest
focal_class.file: everrest-core/src/main/java/org/everrest/core/impl/provider/MultivaluedMapEntityProvider.java
focal_class.identifier: MultivaluedMapEntityProvider
focal_class.interfaces: implements EntityProvider<MultivaluedMap<String, String>>
focal_class.class_method_signature: MultivaluedMapEntityProvider.MultivaluedMapEntityProvider(@Context HttpServletRequest httpRequest)
focal_class.full_signature: public  MultivaluedMapEntityProvider(@Context HttpServletRequest httpRequest)
focal_class.identifier: MultivaluedMapEntityProvider
focal_class.modifiers: public
focal_class.parameters: (@Context HttpServletRequest httpRequest)
focal_class.signature:  MultivaluedMapEntityProvider(@Context HttpServletRequest httpRequest)
focal_class.class_method_signature: MultivaluedMapEntityProvider.isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.full_signature: @Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.identifier: isReadable
focal_class.modifiers: @Override public
focal_class.parameters: (Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.return: boolean
focal_class.signature: boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.class_method_signature: MultivaluedMapEntityProvider.readFrom(Class<MultivaluedMap<String, String>> type,
                                                     Type genericType,
                                                     Annotation[] annotations,
                                                     MediaType mediaType,
                                                     MultivaluedMap<String, String> httpHeaders,
                                                     InputStream entityStream)
focal_class.full_signature: @Override @SuppressWarnings("unchecked") public MultivaluedMap<String, String> readFrom(Class<MultivaluedMap<String, String>> type,
                                                     Type genericType,
                                                     Annotation[] annotations,
                                                     MediaType mediaType,
                                                     MultivaluedMap<String, String> httpHeaders,
                                                     InputStream entityStream)
focal_class.identifier: readFrom
focal_class.modifiers: @Override @SuppressWarnings("unchecked") public
focal_class.parameters: (Class<MultivaluedMap<String, String>> type,
                                                     Type genericType,
                                                     Annotation[] annotations,
                                                     MediaType mediaType,
                                                     MultivaluedMap<String, String> httpHeaders,
                                                     InputStream entityStream)
focal_class.return: MultivaluedMap<String, String>
focal_class.signature: MultivaluedMap<String, String> readFrom(Class<MultivaluedMap<String, String>> type,
                                                     Type genericType,
                                                     Annotation[] annotations,
                                                     MediaType mediaType,
                                                     MultivaluedMap<String, String> httpHeaders,
                                                     InputStream entityStream)
focal_class.class_method_signature: MultivaluedMapEntityProvider.parseKeyValuePair(String pair, MultivaluedMap<String, String> encodedForm, MultivaluedMap<String, String> decodedForm)
focal_class.full_signature: private void parseKeyValuePair(String pair, MultivaluedMap<String, String> encodedForm, MultivaluedMap<String, String> decodedForm)
focal_class.identifier: parseKeyValuePair
focal_class.modifiers: private
focal_class.parameters: (String pair, MultivaluedMap<String, String> encodedForm, MultivaluedMap<String, String> decodedForm)
focal_class.return: void
focal_class.signature: void parseKeyValuePair(String pair, MultivaluedMap<String, String> encodedForm, MultivaluedMap<String, String> decodedForm)
focal_class.class_method_signature: MultivaluedMapEntityProvider.getSize(MultivaluedMap<String, String> multivaluedMap, Class<?> type, Type genericType, Annotation[] annotations,
                          MediaType mediaType)
focal_class.full_signature: @Override public long getSize(MultivaluedMap<String, String> multivaluedMap, Class<?> type, Type genericType, Annotation[] annotations,
                          MediaType mediaType)
focal_class.identifier: getSize
focal_class.modifiers: @Override public
focal_class.parameters: (MultivaluedMap<String, String> multivaluedMap, Class<?> type, Type genericType, Annotation[] annotations,
                          MediaType mediaType)
focal_class.return: long
focal_class.signature: long getSize(MultivaluedMap<String, String> multivaluedMap, Class<?> type, Type genericType, Annotation[] annotations,
                          MediaType mediaType)
focal_class.class_method_signature: MultivaluedMapEntityProvider.isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.full_signature: @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.identifier: isWriteable
focal_class.modifiers: @Override public
focal_class.parameters: (Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.return: boolean
focal_class.signature: boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.class_method_signature: MultivaluedMapEntityProvider.writeTo(MultivaluedMap<String, String> multivaluedMap,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_class.full_signature: @Override public void writeTo(MultivaluedMap<String, String> multivaluedMap,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_class.identifier: writeTo
focal_class.modifiers: @Override public
focal_class.parameters: (MultivaluedMap<String, String> multivaluedMap,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_class.return: void
focal_class.signature: void writeTo(MultivaluedMap<String, String> multivaluedMap,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_method.body: @Override
      @SuppressWarnings("unchecked")
      public MultivaluedMap<String, String> readFrom(Class<MultivaluedMap<String, String>> type,
                                                     Type genericType,
                                                     Annotation[] annotations,
                                                     MediaType mediaType,
                                                     MultivaluedMap<String, String> httpHeaders,
                                                     InputStream entityStream) throws IOException {
          ApplicationContext context = ApplicationContext.getCurrent();
          Object decodedMap = context.getAttributes().get("org.everrest.provider.entity.decoded.form");
          if (decodedMap != null) {
              return (MultivaluedMap<String, String>)decodedMap;
          }
  
          MultivaluedMap<String, String> encodedForm = new MultivaluedMapImpl();
          MultivaluedMap<String, String> decodedForm = new MultivaluedMapImpl();
          StringBuilder sb = new StringBuilder();
          int r;
          while ((r = entityStream.read()) != -1) {
              if (r != '&') {
                  sb.append((char)r);
              } else {
                  parseKeyValuePair(sb.toString().trim(), encodedForm, decodedForm);
                  sb.setLength(0);
              }
          }
          parseKeyValuePair(sb.toString().trim(), encodedForm, decodedForm);
  
          if (decodedForm.isEmpty() && httpRequest != null) {
              httpRequest.getParameterMap()
                         .entrySet()
                         .stream()
                         .filter(e -> e.getValue() != null)
                         .forEach(e -> decodedForm.addAll(e.getKey(), e.getValue()));
          }
  
          context.getAttributes().put("org.everrest.provider.entity.decoded.form", decodedForm);
          context.getAttributes().put("org.everrest.provider.entity.encoded.form", encodedForm);
  
          return decodedForm;
      }
focal_method.class_method_signature: MultivaluedMapEntityProvider.readFrom(Class<MultivaluedMap<String, String>> type,
                                                     Type genericType,
                                                     Annotation[] annotations,
                                                     MediaType mediaType,
                                                     MultivaluedMap<String, String> httpHeaders,
                                                     InputStream entityStream)
focal_method.full_signature: @Override @SuppressWarnings("unchecked") public MultivaluedMap<String, String> readFrom(Class<MultivaluedMap<String, String>> type,
                                                     Type genericType,
                                                     Annotation[] annotations,
                                                     MediaType mediaType,
                                                     MultivaluedMap<String, String> httpHeaders,
                                                     InputStream entityStream)
focal_method.identifier: readFrom
focal_method.invocations: getCurrent get getAttributes read append parseKeyValuePair trim toString setLength parseKeyValuePair trim toString isEmpty forEach filter stream entrySet getParameterMap getValue addAll getKey getValue put getAttributes put getAttributes
focal_method.modifiers: @Override @SuppressWarnings("unchecked") public
focal_method.parameters: (Class<MultivaluedMap<String, String>> type,
                                                     Type genericType,
                                                     Annotation[] annotations,
                                                     MediaType mediaType,
                                                     MultivaluedMap<String, String> httpHeaders,
                                                     InputStream entityStream)
focal_method.return: MultivaluedMap<String, String>
focal_method.signature: MultivaluedMap<String, String> readFrom(Class<MultivaluedMap<String, String>> type,
                                                     Type genericType,
                                                     Annotation[] annotations,
                                                     MediaType mediaType,
                                                     MultivaluedMap<String, String> httpHeaders,
                                                     InputStream entityStream)