### Question:
StringInterpolator { public Set<String> getVariables(String template) { Set<String> variables = Sets.newHashSet(); Matcher m = PATTERN.matcher(template); while (m.find()) { variables.add(m.group(1)); } return ImmutableSet.copyOf(variables); }  String interpolate(String template,
                            final Map<String, ?> variables); String interpolate(String template,
                            VariableProvider provider); Set<String> getVariables(String template); Map<String, String> interpolateValues(@Nullable Map<String, String> templates,
                                               VariableProvider provider); List<String> interpolateList(@Nullable List<String> templates,
                                      VariableProvider provider);  }### Answer:
@Test public void testGetVariables() { assertEquals(ImmutableSet.of("var", "var2"), interpolator.getVariables( "This is a ${var} and ${var2} and ${var}")); }