DefaultInputItem implements InputItem { @Override public MediaType getMediaType() { final String contentType = fileItem.getContentType(); return contentType == null ? null : MediaType.valueOf(contentType); } DefaultInputItem(FileItem fileItem, Providers providers); @Override String getName(); @Override String getFilename(); @Override MediaType getMediaType(); @Override MultivaluedMap<String, String> getHeaders(); @Override InputStream getBody(); @Override T getBody(Class<T> type, Type genericType); @Override String getBodyAsString();  }
@Test public void getsMediaType() throws Exception { when(fileItem.getContentType()).thenReturn("text/plain"); assertEquals(TEXT_PLAIN_TYPE, inputItem.getMediaType()); }
@Test public void getsNullMediaTypeIfContentTypeInFileItemIsNotAvailable() throws Exception { assertNull(inputItem.getMediaType()); }