### Question:
DownloadSubstituters { public static Function<DownloadRequirement, DownloadTargets> substituter(Function<? super DownloadRequirement, String> basevalueProducer, Function<? super DownloadRequirement, ? extends Map<String,?>> subsProducer) { return new Substituter(basevalueProducer, subsProducer); } private  DownloadSubstituters(); static String substitute(DownloadRequirement req, String basevalue); static Map<String,Object> getBasicSubstitutions(DownloadRequirement req); static Map<String,Object> getBasicEntitySubstitutions(EntityDriver driver); static Map<String,Object> getBasicAddonSubstitutions(EntityDriver driver, String addon); static String substitute(String basevalue, Map<String,?> substitutions); static Function<DownloadRequirement, DownloadTargets> substituter(Function<? super DownloadRequirement, String> basevalueProducer, Function<? super DownloadRequirement, ? extends Map<String,?>> subsProducer);  }### Answer:
@Test public void testSubstituter() throws Exception { entity.config().set(BrooklynConfigKeys.SUGGESTED_VERSION, "myversion"); String baseurl = "version=${version},type=${type},simpletype=${simpletype}"; Map<String,Object> subs = DownloadSubstituters.getBasicEntitySubstitutions(driver); DownloadTargets result = DownloadSubstituters.substituter(Functions.constant(baseurl), Functions.constant(subs)).apply(new BasicDownloadRequirement(driver)); String expected = String.format("version=%s,type=%s,simpletype=%s", "myversion", TestEntity.class.getName(), TestEntity.class.getSimpleName()); assertEquals(result.getPrimaryLocations(), ImmutableList.of(expected)); }