@Test
public void testUploadSomething() {
URL imageURL = reverse(); {
Binary.showAvatar(1l);
}
Response getResponse = GET(imageURL);
assertStatus(404, getResponse);
URL url = reverse(); {
Binary.save(null);
}
Map<String,String> parameters= new HashMap<String,String>();
parameters.put("user.username", "username");
Map<String, File> files= new HashMap<String, File>();
File f = Play.getFile("test/fond1.png");
assertTrue(f.exists());
files.put("user.avatar", f);
Response uploadResponse = POST(url, parameters, files);
assertStatus(302, uploadResponse);
String id = uploadResponse.getHeader("Location").split("=")[1];
imageURL = reverse(); {
Binary.showAvatar(new Long(id));
}
getResponse = GET(imageURL);
assertStatus(200, getResponse);