EnvBuilder { public String build(final OsFamily osFamily) { StringBuilder builder = new StringBuilder(); builder.append(Utils.writeComment(" Env file: please do not confuse people by making this executable", osFamily)); builder.append(Utils.writeComment("", osFamily)); builder.append(Utils.writeComment(" Example usage to set a variable", osFamily)); builder.append(Utils.writeComment("", osFamily)); builder.append(Utils.writeComment(" " + Utils.writeVariableExporters(ImmutableMap.of("MAVEN_OPTS", "-Xms64m -Xmx128m"), osFamily), osFamily)); builder.append(Utils.writeVariableExporters(variables, osFamily)); builder.append(ShellToken.LF.to(osFamily)); builder.append(Utils.writeComment( " Please retain this statement so that the script can be validated", osFamily)); builder.append(ShellToken.RETURN.to(osFamily)).append(" 0") .append(ShellToken.LF.to(osFamily)); return builder.toString(); }  EnvBuilder export(String name, String value); String build(final OsFamily osFamily);  }
@Test public void testBuildSimpleWindows() throws MalformedURLException, IOException { assertEquals(testScriptBuilder.build(OsFamily.WINDOWS), Resources.toString(Resources.getResource("test_env." + ShellToken.SH.to(OsFamily.WINDOWS)), Charsets.UTF_8)); }
@Test public void testBuildSimpleUNIX() throws MalformedURLException, IOException { assertEquals(testScriptBuilder.build(OsFamily.UNIX), Resources.toString(Resources.getResource("test_env." + ShellToken.SH.to(OsFamily.UNIX)), Charsets.UTF_8)); }