### Question:
DynamicPathTemplate implements Serializable { public List<String> extractValuesFrom(Map<String, String> attributes) { if (placeholderNames.isEmpty()) { return Collections.emptyList(); } if (attributes == null) { attributes = new HashMap<>(); } List<String> placeholderValues = new ArrayList<>(placeholderNames.size()); for (int i = 0; i < placeholderNames.size(); i++) { String name = placeholderNames.get(i); String value = attributes.get(name); if (value == null) { value = placeholderDefaults.get(i); } placeholderValues.add(value); } return placeholderValues; } DynamicPathTemplate(String rawPath); List<String> getPlaceholderNames(); Map<String, String> getPlaceholderAttributes(List<String> values); String replaceDynamicPart(List<String> values); List<String> extractValuesFrom(Map<String, String> attributes); final String staticPrefix; final String dynamicPart; }### Answer:
@Test public void testExtractValuesFrom() { final DynamicPathTemplate path = new DynamicPathTemplate("tmp/${bar:-b}-${foo:-f}/test"); final ImmutableMap<String, String> attributes = ImmutableMap.of("bar", "hi", "foo", "there", "unused", "blah"); assertThat(path.extractValuesFrom(attributes), is(ImmutableList.of("hi", "there"))); assertThat(path.extractValuesFrom(null), is(ImmutableList.of("b", "f"))); }