### Question:
CombinedVariablesSource extends VariablesSource { public static CombinedVariablesSource forSources(List<String> sourceNames, InstallHookLogger logger, InstallContext context) { List<VariablesSource> sources = new ArrayList<VariablesSource>(); for (String string : sourceNames) { if(string.equals(OsEnvVarsSource.NAME)) { sources.add(new OsEnvVarsSource()); } else if (string.equals(SystemPropertiesVarsSource.NAME)) { sources.add(new SystemPropertiesVarsSource()); } else if (string.equals(JcrVarsSource.NAME)) { sources.add(new JcrVarsSource(logger, context)); } else if(string.equals(ZooKeeperVarsSource.NAME)) { sources.add(new ZooKeeperVarsSource(logger)); } else { logger.log("Could not find source "+string+" ignoring"); } } return new CombinedVariablesSource(StringUtils.join(sourceNames,", "), sources); } CombinedVariablesSource(String name, List<VariablesSource> sources); static CombinedVariablesSource forSources(List<String> sourceNames, InstallHookLogger logger, InstallContext context); NamedValue get(String varName);  }### Answer:
@Test public void testForSources() { VariablesSource varSource1 = new VariablesSource("testsource1", new HashMap<String, String>() { { put("var1", "val1"); put("var2", "val2"); } }) { }; VariablesSource varSource2 = new VariablesSource("testsource2", new HashMap<String, String>() { { put("var2", "val2hidden"); put("var3", "val3"); } }) { }; CombinedVariablesSource combinedVariablesSource = new CombinedVariablesSource("", Arrays.asList(varSource1, varSource2)); NamedValue namedValue1 = combinedVariablesSource.get("var1"); assertEquals("testsource1", namedValue1.sourceName); assertEquals("val1", namedValue1.value); NamedValue namedValue2 = combinedVariablesSource.get("var2"); assertEquals("testsource1", namedValue2.sourceName); assertEquals("val2", namedValue2.value); NamedValue namedValue3 = combinedVariablesSource.get("var3"); assertEquals("testsource2", namedValue3.sourceName); assertEquals("val3", namedValue3.value); NamedValue namedValue4 = combinedVariablesSource.get("val4"); assertNull(namedValue4); }