@Test public void testExpandWithEnvVarResolver() { assumeTrue("Environment variable not set as required", System.getenv().containsKey(TEST_ENV_VARIABLE_NAME)); assertEquals("Environment variable value not as expected", TEST_ENV_VARIABLE_VALUE, System.getenv(TEST_ENV_VARIABLE_NAME)); final Resolver resolver = VariableExpansion.ENV_VAR_RESOLVER; try { VariableExpansion.expand("${" + TEST_ENV_VARIABLE_NAME + "_NOT_SET" + "}", resolver); fail("Should have failed to expand unset env variable"); } catch (IllegalArgumentException iae) { } String expanded = VariableExpansion.expand("${" + TEST_ENV_VARIABLE_NAME + "}", resolver); assertEquals("Expanded variable not as expected", TEST_ENV_VARIABLE_VALUE, expanded); }
public static final String expand(String input, Resolver resolver) throws UnresolvedVariableException, IllegalArgumentException, NullPointerException { if(resolver == null) { throw new NullPointerException("Resolver must be supplied"); } if (input == null) { return null; } return expand0(input, resolver, new Stack<String>()); }
VariableExpansion { public static final String expand(String input, Resolver resolver) throws UnresolvedVariableException, IllegalArgumentException, NullPointerException { if(resolver == null) { throw new NullPointerException("Resolver must be supplied"); } if (input == null) { return null; } return expand0(input, resolver, new Stack<String>()); } }
VariableExpansion { public static final String expand(String input, Resolver resolver) throws UnresolvedVariableException, IllegalArgumentException, NullPointerException { if(resolver == null) { throw new NullPointerException("Resolver must be supplied"); } if (input == null) { return null; } return expand0(input, resolver, new Stack<String>()); } private  VariableExpansion(); }
VariableExpansion { public static final String expand(String input, Resolver resolver) throws UnresolvedVariableException, IllegalArgumentException, NullPointerException { if(resolver == null) { throw new NullPointerException("Resolver must be supplied"); } if (input == null) { return null; } return expand0(input, resolver, new Stack<String>()); } private  VariableExpansion(); static final String expand(String input, Resolver resolver); }
VariableExpansion { public static final String expand(String input, Resolver resolver) throws UnresolvedVariableException, IllegalArgumentException, NullPointerException { if(resolver == null) { throw new NullPointerException("Resolver must be supplied"); } if (input == null) { return null; } return expand0(input, resolver, new Stack<String>()); } private  VariableExpansion(); static final String expand(String input, Resolver resolver); static final Resolver ENV_VAR_RESOLVER; static final Resolver SYS_PROP_RESOLVER; }