### Question:
Helper { public static Map<String, String> parseRequest(HttpServletRequest request) { Map<String, String> htmlFormItems = new HashMap<String, String>(); try { FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List items; items = upload.parseRequest(request); Iterator iter = items.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); if (item.isFormField()) { htmlFormItems.put(item.getFieldName(), item.getString()); } else if (item.getFieldName().startsWith("file_workflow")) { htmlFormItems.put(item.getFieldName(), new String(item.get())); } else { String currentAttachment = new String(Base64.encode(item.get())); htmlFormItems.put(item.getFieldName(), currentAttachment); } } } catch (FileUploadException e) { e.printStackTrace(); } return htmlFormItems; }  static HttpClient createAuthenticatingClient(String domain,
			String user, String password); static Object applyXPathSingleNode(InputStream xmlStream,
			String xpathExpression); static List applyXPathSeveralNodes(InputStream xmlStream,
                                              String xpathExpression); static Map<String, String> parseRequest(HttpServletRequest request);  }### Answer:
@Test public void testParseRequest() throws Exception { HttpServletRequest request = mock(HttpServletRequest.class); URL url = this.getClass().getResource("/prueba.txt"); File testFile = new File(url.getFile()); Part[] parts = new Part[] { new StringPart("user", "user"), new FilePart("file_workflow",testFile), new FilePart("comon_file",testFile) }; MultipartRequestEntity multipartRequestEntity = new MultipartRequestEntity(parts, new PostMethod().getParams()); ByteArrayOutputStream requestContent = new ByteArrayOutputStream(); multipartRequestEntity.writeRequest(requestContent); final ByteArrayInputStream inputContent = new ByteArrayInputStream (requestContent.toByteArray ()); when(request.getInputStream()).thenReturn(new ServletInputStream() { @Override public int read() throws IOException { return inputContent.read(); } }); when(request.getContentType()).thenReturn(multipartRequestEntity.getContentType()); Helper.parseRequest(request); }