### Question:
CLIUtil { public static Map<String, String> readPasswordFileOptions(final String passwordFileName, boolean withPrefix) throws CommandException { Map<String, String> passwordOptions = new HashMap<String, String>(); boolean readStdin = passwordFileName.equals("-"); InputStream is = null; try { is = new BufferedInputStream(readStdin ? System.in : new FileInputStream(passwordFileName)); final Properties prop = new Properties(); prop.load(is); for (Object key : prop.keySet()) { final String entry = (String)key; if (entry.startsWith(Environment.getPrefix())) { final String optionName; if (withPrefix){ optionName = entry; } else { optionName = entry.substring(Environment.getPrefix().length()).toLowerCase(Locale.ENGLISH); } final String optionValue = prop.getProperty(entry); passwordOptions.put(optionName, optionValue); } } } catch (final Exception e) { throw new CommandException(e); } finally { try { if (!readStdin && is != null) is.close(); } catch (final Exception ignore) { } } return passwordOptions; }  static Map<String, String> readPasswordFileOptions(final String passwordFileName, boolean withPrefix); static void displayClosestMatch(final String commandName, String[] commands, final String msg, final Logger logger); static String[] getAllCommands(CLIContainer container, ProgramOptions options, Environment env); static String[] getLocalCommands(CLIContainer container); static String[] getRemoteCommands(CLIContainer container, ProgramOptions po, Environment env); static void writeCommandToDebugLog(String cname, Environment env, String[] args, int exit);  }### Answer:
@Test public void getUploadFileTest() { BufferedWriter out = null; String fileName = null; try { final File f = File.createTempFile("TestPasswordFile", ".tmp"); fileName = f.toString(); f.deleteOnExit(); out = new BufferedWriter(new FileWriter(f)); out.write("AS_ADMIN_PASSWORD=adminadmin\n"); out.write("AS_ADMIN_MASTERPASSWORD=changeit\n"); } catch (IOException ioe) { } finally { try { if (out != null) out.close(); } catch(final Exception ignore){} } try { Map<String, String> po = CLIUtil.readPasswordFileOptions(fileName, false); assertEquals("admin password", "adminadmin", po.get("password")); assertEquals("master password", "changeit", po.get("masterpassword")); assertEquals("null", null, po.get("foobar")); } catch (CommandException ce) { ce.printStackTrace(); } }