CollectionMultipartFormDataMessageBodyWriter implements MessageBodyWriter<Collection<OutputItem>> { @Override public long getSize(Collection<OutputItem> items, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; } CollectionMultipartFormDataMessageBodyWriter(@Context Providers providers);   CollectionMultipartFormDataMessageBodyWriter(MultipartFormDataWriter multipartFormDataWriter); @Override boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override long getSize(Collection<OutputItem> items, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override void writeTo(Collection<OutputItem> items, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream);  }
@Test public void sizeOfContentCannotBeDetermined() throws Exception { Class<Collection> type = Collection.class; ParameterizedType genericType = ParameterizedTypeImpl.newParameterizedType(Collection.class, OutputItem.class); assertEquals(-1, collectionMultipartFormDataMessageBodyWriter.getSize(newArrayList(), type, genericType, new Annotation[0], TEXT_PLAIN_TYPE)); }