@Test public void unmatchedPlaceholdersWithMultipleOccurences() throws FlywayException { thrown.expect(FlywayException.class); thrown.expectMessage( "No value provided for placeholder expressions: ${placeholder}, ${replace}. Check your configuration!"); Map<String, String> placeholders = new HashMap<String, String>(); PlaceholderReplacer placeholderReplacer = new PlaceholderReplacer(placeholders, "${", "}"); placeholderReplacer.replacePlaceholders(TEST_STR + TEST_STR); }
@Test public void exoticPlaceholders() { Map<String, String> placeholders = new HashMap<String, String>(); placeholders.put("left", "right"); PlaceholderReplacer placeholderReplacer = new PlaceholderReplacer(placeholders, "#[", "]"); assertEquals( "No ${placeholder} right to ${replace}", placeholderReplacer.replacePlaceholders(TEST_STR)); }
@Test public void unmatchedPlaceholders() throws FlywayException { thrown.expect(FlywayException.class); thrown.expectMessage( "No value provided for placeholder expressions: #[left]. Check your configuration!"); Map<String, String> placeholders = new HashMap<String, String>(); PlaceholderReplacer placeholderReplacer = new PlaceholderReplacer(placeholders, "#[", "]"); placeholderReplacer.replacePlaceholders(TEST_STR); }
@Test public void antStylePlaceholders() { Map<String, String> placeholders = new HashMap<String, String>(); placeholders.put("placeholder", "value"); placeholders.put("replace", "be replaced"); placeholders.put("dummy", "shouldNotAppear"); PlaceholderReplacer placeholderReplacer = new PlaceholderReplacer(placeholders, "${", "}"); assertEquals( "No value #[left] to be replaced", placeholderReplacer.replacePlaceholders(TEST_STR)); }