Skip to content

Commit

Permalink
Add test for hidden map keys
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez committed Jul 24, 2024
1 parent 4863a60 commit 4fc42b1
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -2606,4 +2607,34 @@ interface NestedLeadfsMaps {
@WithParentName
Map<String, Map<String, Map<String, String>>> tripleMap();
}

@Test
void hiddenMapValue() {
SmallRyeConfig config = new SmallRyeConfigBuilder()
.withDefaultValue("hidden.key.force", "true")
.withSources(new MapBackedConfigSource("", Map.of("hidden.key.value", "value")) {
@Override
public Set<String> getPropertyNames() {
return Collections.emptySet();
}
})
.withMapping(HiddenMapValue.class)
.build();

HiddenMapValue mapping = config.getConfigMapping(HiddenMapValue.class);
assertEquals("value", mapping.map().get("key").value());
}

@ConfigMapping(prefix = "hidden")
interface HiddenMapValue {
@WithParentName
Map<String, Nested> map();

interface Nested {
@WithDefault("false")
boolean force();

String value();
}
}
}

0 comments on commit 4fc42b1

Please sign in to comment.