DefaultInputItem implements InputItem { @Override public String getBodyAsString() throws IOException { return fileItem.getString(); } 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 getsBodyAsString() throws Exception { when(fileItem.getString()).thenReturn("content"); assertEquals("content", inputItem.getBodyAsString()); }