Skip to content

Commit

Permalink
Fix audit related naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ogesaku committed Jan 17, 2023
1 parent c1c3036 commit 114fc67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/coditory/quark/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ default AuditableConfig auditable() {
return AuditableConfig.of(this);
}

default <T> T auditMap(@NotNull Function<Config, T> configMapper) {
default <T> T mapAuditable(@NotNull Function<Config, T> configMapper) {
AuditableConfig auditableConfig = AuditableConfig.of(this);
T result = configMapper.apply(auditableConfig);
auditableConfig.failOnUnusedProperties();
return result;
}

default void audit(@NotNull Consumer<Config> configConsumer) {
default void consumeAuditable(@NotNull Consumer<Config> configConsumer) {
AuditableConfig auditableConfig = AuditableConfig.of(this);
configConsumer.accept(auditableConfig);
auditableConfig.failOnUnusedProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ class AuditableConfigSpec extends Specification {
.putAll(a: "A", b: "B")
.build()
when:
config.audit {
config.consumeAuditable {
it.getString("a")
}
then:
ConfigUnusedPropertiesException e = thrown(ConfigUnusedPropertiesException)
e.message == "Detected unused config properties:\nb"

when:
config.audit {
config.consumeAuditable {
it.getString("a")
it.getString("b")
}
Expand All @@ -126,7 +126,7 @@ class AuditableConfigSpec extends Specification {
.putAll(a: "A", b: "B")
.build()
when:
String result = config.auditMap {
String result = config.mapAuditable {
it.getString("a")
}
then:
Expand All @@ -135,7 +135,7 @@ class AuditableConfigSpec extends Specification {
result == null

when:
result = config.auditMap {
result = config.mapAuditable {
it.getString("a") + it.getString("b")
}
then:
Expand Down

0 comments on commit 114fc67

Please sign in to comment.