### Question:
AbstractFileTransport extends AbstractTransport { synchronized File createMessageFile(String baseName) throws IOException { int suffix = -1; File file; do { suffix++; StringBuilder sb = new StringBuilder(baseName); if (suffix > 0) { sb.append('-').append(suffix); } sb.append('.').append(getFilenameExtension()); file = new File(directory, sb.toString()); } while (file.exists()); if (! file.createNewFile()) { throw new IOException("Cannot create file " + file.getAbsolutePath()); } return file; } AbstractFileTransport(Session session, URLName urlname); @Override void sendMessage(Message message, Address[] addresses);  }### Answer:
@Test public void testFilename() throws Exception { File f0 = transport.createMessageFile(BASE_NAME); File f1 = transport.createMessageFile(BASE_NAME); Assert.assertEquals("base-name.ext", f0.getName()); Assert.assertEquals("base-name-1.ext", f1.getName()); }