J2EETempFileFactory implements TemporaryFileFactory { public File prepareTempFile(String desiredName) { if (desiredName == null || desiredName.length() == 0) { throw new IllegalArgumentException( String .format( "The desired name of a temporary file must not be null or empty (was: '%s')", desiredName)); } return new File(getTempFileDir(), desiredName); } J2EETempFileFactory(String tempFileDirID); File getTempFileDir(); File prepareRandomNamedTempFile(); File prepareRandomNamedTempFile(String humanReadableID); File prepareTempFile(String desiredName);  }
@Test public void testPrepareTempFileString() { final String desiredFileName = "myOddlyNamedFile"; final File tempFile = this.tempFileFactory.prepareTempFile(desiredFileName); assertNotNull("The generated temporary file path should not be null", tempFile.getPath()); assertEquals("Un-expected filename.", desiredFileName, tempFile .getName()); }