### Question:
MainHelper { public static Properties parseAsEnv(File installRoot) { Properties asenvProps = new Properties(); File configDir = new File(installRoot, "config"); File asenv = getAsEnvConf(configDir); if (!asenv.exists()) { if (logger.isLoggable(Level.FINE)) { logger.fine(asenv.getAbsolutePath() + " not found, ignoring"); } return asenvProps; } LineNumberReader lnReader = null; try { lnReader = new LineNumberReader(new FileReader(asenv)); String line = lnReader.readLine(); Pattern p = Pattern.compile("(?i)(set +)?([^=]*)=\"?([^\"]*)\"?"); while (line != null) { Matcher m = p.matcher(line); if (m.matches()) { File f = new File(m.group(3)); if (!f.isAbsolute()) { f = new File(configDir, m.group(3)); if (f.exists()) { asenvProps.put(m.group(2), f.getAbsolutePath()); } else { asenvProps.put(m.group(2), m.group(3)); } } else { asenvProps.put(m.group(2), m.group(3)); } } line = lnReader.readLine(); } } catch (IOException ioe) { throw new RuntimeException("Error opening asenv.conf : ", ioe); } finally { try { if (lnReader != null) lnReader.close(); } catch (IOException ioe) { } } return asenvProps; }  static Properties parseAsEnv(File installRoot); static Properties buildStaticStartupContext(long timeZero, String... args); static void buildStartupContext(Properties ctx);  }### Answer:
@Test public void parseAsEnvTest() { try { File resources = File.createTempFile("helperTestResources", "config"); resources.delete(); resources.mkdir(); resources.deleteOnExit(); File config = new File(resources, "config"); config.mkdir(); config.deleteOnExit(); File asenv_bat = new File(config, "asenv.bat"); File asenv_conf = new File(config, "asenv.conf"); asenv_bat.deleteOnExit(); asenv_conf.deleteOnExit(); PrintWriter pw1 = new PrintWriter(asenv_bat); pw1.println("set AbcVar=value1"); pw1.println("SET Avar=\"value2\""); pw1.println("Set Bvar=\"value3\""); pw1.println("set setVar=\"value4\""); pw1.println("set SetVar=value5"); pw1.println("set seVar=\"value6\""); pw1.println("set sVar=\"value7\""); pw1.close(); PrintWriter pw2 = new PrintWriter(asenv_conf); pw2.println("AbcVar=value1"); pw2.println("Avar=\"value2\""); pw2.println("Bvar=\"value3\""); pw2.println("setVar=\"value4\""); pw2.println("SetVar=value5"); pw2.println("seVar=\"value6\""); pw2.println("sVar=\"value7\""); pw2.close(); File installRoot = new File(resources.toString()); Properties asenvProps = MainHelper.parseAsEnv(installRoot); assertEquals("value1",asenvProps.getProperty("AbcVar")); assertEquals("value2",asenvProps.getProperty("Avar")); assertEquals("value3",asenvProps.getProperty("Bvar")); assertEquals("value4",asenvProps.getProperty("setVar")); assertEquals("value5",asenvProps.getProperty("SetVar")); assertEquals("value6",asenvProps.getProperty("seVar")); assertEquals("value7",asenvProps.getProperty("sVar")); } catch (Exception e) { e.printStackTrace(); } }