Fix partial placeholder replacement, fix tests

This commit is contained in:
filoghost 2021-07-24 14:36:51 +02:00
parent 7d86538621
commit 1440a88387
2 changed files with 1 additions and 1 deletions

View File

@ -88,7 +88,6 @@ public final class StringWithPlaceholders {
output.setLength(0);
}
newStringParts.add(placeholderStringPart);
output.append(placeholderStringPart.nonReplacedString);
fullOutput.append(placeholderStringPart.nonReplacedString);
}
} else {

View File

@ -35,6 +35,7 @@ class StringWithPlaceholdersTest {
StringWithPlaceholders s = StringWithPlaceholders.of(input);
assertThat(s.partiallyReplacePlaceholders(occurrence -> "#").getUnreplacedString()).isEqualTo(expectedOutput);
assertThat(s.partiallyReplacePlaceholders(occurrence -> null).replacePlaceholders(occurrence -> "#")).isEqualTo(expectedOutput);
assertThat(s.containsPlaceholders()).isEqualTo(expectedContainsPlaceholders);
}