### Question:
PlaceholderResolver { @VisibleForTesting static List<String> extractPlaceholderStrings(String value) { Matcher matcher = PLACEHOLDER_REGEX_CAPTURE_ALL.matcher(value); List<String> placeholders = new ArrayList<>(); while (matcher.find()) { placeholders.add(matcher.group()); } return placeholders; } PlaceholderResolver(ObjectNode rootNode, Map<String, String> externalProperties); static Collection<UnresolvedPlaceholder> resolvePlaceholders(JsonNode rootNode, Map<String, String> externalProperties); static Collection<UnresolvedPlaceholder> resolvePlaceholders(JsonNode rootNode, Properties properties); Collection<UnresolvedPlaceholder> resolve(); @VisibleForTesting static String replacePlaceholder(String originalString, String placeholderName, String placeholderValue); @VisibleForTesting static List<Placeholder> extractPlaceholders(String value);  }### Answer:
@Test public void extractsPlaceholders() { String valueWithPlaceholders = "foo ${with.default:defaultValue} bar ${without.default} ${configLocation:classpath:}foo"; List<String> placeholders = PlaceholderResolver.extractPlaceholderStrings(valueWithPlaceholders); assertThat(placeholders, contains("${with.default:defaultValue}", "${without.default}", "${configLocation:classpath:}")); }
@Test public void extractsPlaceholdersWithEmptyDefaults() { String valueWithPlaceholders = "foo: \"${FOO:}\""; List<String> placeholders = PlaceholderResolver.extractPlaceholderStrings(valueWithPlaceholders); assertThat(placeholders, contains("${FOO:}")); }