Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public class ContextPairs {
/**
* Add pairs using flat naming.
* @param <T> the item type
* @param delimeter the delimiter used if there is a prefix
* @param delimiter the delimiter used if there is a prefix
* @param pairs callback to add all the pairs
* @return a {@link BiConsumer} for use with the {@link JsonWriter}
*/
public <T> BiConsumer<T, BiConsumer<String, Object>> flat(String delimeter, Consumer<Pairs<T>> pairs) {
return flat(joinWith(delimeter), pairs);
public <T> BiConsumer<T, BiConsumer<String, Object>> flat(String delimiter, Consumer<Pairs<T>> pairs) {
return flat(joinWith(delimiter), pairs);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ void flatWhenPrefixAppliesPrefix() {
}

@Test
void flatWhenPrefixEndingWithDelimeterAppliesPrefix() {
void flatWhenPrefixEndingWithDelimiterAppliesPrefix() {
ContextPairs contextPairs = new ContextPairs(true, "the_");
Map<String, String> map = Map.of("spring", "boot");
Map<String, Object> actual = apply(contextPairs.flat("_", (pairs) -> pairs.addMapEntries((item) -> map)));
assertThat(actual).containsOnly(entry("the_spring", "boot"));
}

@Test
void flatWhenPrefixAndNameStartingWithDelimeterAppliesPrefix() {
void flatWhenPrefixAndNameStartingWithDelimiterAppliesPrefix() {
ContextPairs contextPairs = new ContextPairs(true, "the");
Map<String, String> map = Map.of("_spring", "boot");
Map<String, Object> actual = apply(contextPairs.flat("_", (pairs) -> pairs.addMapEntries((item) -> map)));
Expand Down