ScriptBuilder implements Statement, AcceptsStatementVisitor { public ScriptBuilder addEnvironmentVariableScope(String scopeName, Map<String, String> variables) { variableScopes.put(checkNotNull(scopeName, "scopeName"), checkNotNull(variables, "variables")); return this; }  ScriptBuilder addStatement(Statement statement); ScriptBuilder unsetEnvironmentVariable(String name); ScriptBuilder addEnvironmentVariableScope(String scopeName, Map<String, String> variables); static Statement forget(String instanceName, String script, String logDir); static Statement findPid(String pid); static Statement call(String fn, String... args); @Override String render(OsFamily osFamily); static void writeFunctions(Map<String, String> functionsToWrite, OsFamily osFamily, StringBuilder builder); @VisibleForTesting static Map<String, String> resolveFunctionDependenciesForStatements(Map<String, String> knownFunctions,
         Iterable<Statement> statements, final OsFamily osFamily); @Override Iterable<String> functionDependencies(OsFamily family); @Override void accept(StatementVisitor visitor);  }
@Test public void testExport() { ScriptBuilder builder = new ScriptBuilder(); builder.addEnvironmentVariableScope("default", ImmutableMap.of("JAVA_HOME", "/apps/jdk1.6")); assertEquals(builder.variableScopes, ImmutableMap.of("default", ImmutableMap.of("JAVA_HOME", "/apps/jdk1.6"))); }
@Test(expectedExceptions = NullPointerException.class) public void testExportNPE() { new ScriptBuilder().addEnvironmentVariableScope(null, null); }