Skip to content

Commit

Permalink
test standalone placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
fslev committed Nov 19, 2022
1 parent 747094f commit e17cd4d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/java/io/jtest/utils/common/StringParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

Expand All @@ -23,4 +24,15 @@ public void testValueCaptureAndReplacePlaceholders() {
Object result = StringParser.replacePlaceholders(placeHolders, source, prefix, suffix, ph -> ph + "OK", ph -> true);
assertEquals("test var1OK string parser var2OK. Ok ? $ Good.", result);
}

@Test
public void testValueCaptureAndReplaceStandalonePlaceholder() {
String prefix = "#[";
String suffix = "]";
List<String> placeHolders = new ArrayList<>();
placeHolders.add("var1");
String source = "#[var1]";
Object result = StringParser.replacePlaceholders(placeHolders, source, prefix, suffix, ph -> 10.00, ph -> true);
assertEquals(10.00, result);
}
}

0 comments on commit e17cd4d

Please sign in to comment.