Unit testing file upload in a controller with Java Play Framework 2.3.x
After working most of the day I feel like I am fairly close to a solution on how to test a controller method which accepts file uploads from JUnit. My juint test code is as follows: Map<String, String> postData = makePostMap(uploadForm); File file = new File("test/resources/shared/uploads/blank.csv"); TemporaryFile temporaryFile = new TemporaryFile(file); MultipartFormData.FilePart filePath = new MultipartFormData.FilePart( "file", "file.csv", new scala.Some<>("text/csv"), temporaryFile); List<MultipartFormData.FilePart> fileParts = Lists.newArrayList(filePath); scala.collection.immutable.Seq