Q: Using POST with a file a jUnit test with the Play! Framework I am trying to write a POST test where I have to sent an XML file to the server (with the PLay! Framework). However, I must do something wrong. When ran the result is that there is no 'data' in the Controller.
This is my code:
routes:
POST    /server/?                               Server.index(format:'xml')

Controller:
   public static void index(Upload data) {
        if (data != null){
                DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = dbf.newDocumentBuilder();

                Document xmlDoc = builder.parse(data.asStream());
         }
       etc..
   }

Test:
    File f = new File("request.xml");
    TransformerFactory tFactory =
            TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();

    DOMSource source = new DOMSource(doc);
    StreamResult result = new StreamResult(f);
    transformer.transform(source, result);

    Map<String,String> map = new HashMap<String,String>();
    //map.put("data", xmlString);

    Map<String,File> files = new HashMap<String,File>();

    files.put("request.xml", f);
    Http.Response response = POST("/server/", map, files);
    assertIsOk(response);

    f.delete();

    StringReader reader = new StringReader(response.out.toString());
    InputSource inputSource = new InputSource( reader );
    Document xmlDoc = builder.parse( inputSource );
    reader.close();

