AliasManager { public void persist() { if(persistAlias && aliasFile != null) { try { boolean keepGoing = true; if(aliasFile.isFile()) keepGoing = aliasFile.delete(); if(keepGoing) { File parentFile = aliasFile.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } keepGoing = aliasFile.createNewFile(); } if(keepGoing) { FileWriter fw = new FileWriter(aliasFile); Collections.sort(aliases); for(Alias a : aliases) { fw.write(ALIAS_SPACE + a.toString() + Config.getLineSeparator()); } fw.flush(); fw.close(); } } catch(IOException e) { LOGGER.log(Level.WARNING, "Could not persist to alias file:", e); } } } AliasManager(File aliasFile, boolean persistAlias); boolean verifyNoNewAliasConflict(String aliasName); void persist(); @SuppressWarnings("unchecked") String printAllAliases(); Optional<Alias> getAlias(String name); Optional<String> getAliasName(String input); List<String> findAllMatchingNames(String name); List<String> getAllNames(); String removeAlias(String buffer); String parseAlias(String buffer); String aliasUsage(); String unaliasUsage();  }
@Test public void testPersist() throws Exception { manager.persist(); assertTrue("The persistent file should be a file", fooFile.isFile()); }