Skip to content

Commit

Permalink
Correct handling of disable-html-escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkinsona committed Feb 12, 2024
1 parent 5746886 commit d597a4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void customize(GsonBuilder builder) {
map.from(properties::getFieldNamingPolicy).to(builder::setFieldNamingPolicy);
map.from(properties::getPrettyPrinting).whenTrue().toCall(builder::setPrettyPrinting);
map.from(properties::getLenient).whenTrue().toCall(builder::setLenient);
map.from(properties::getDisableHtmlEscaping).whenFalse().toCall(builder::disableHtmlEscaping);
map.from(properties::getDisableHtmlEscaping).whenTrue().toCall(builder::disableHtmlEscaping);
map.from(properties::getDateFormat).to(builder::setDateFormat);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ void withoutDisableHtmlEscaping() {
void withDisableHtmlEscapingTrue() {
this.contextRunner.withPropertyValues("spring.gson.disable-html-escaping:true").run((context) -> {
Gson gson = context.getBean(Gson.class);
assertThat(gson.htmlSafe()).isTrue();
assertThat(gson.htmlSafe()).isFalse();
});
}

@Test
void withDisableHtmlEscapingFalse() {
this.contextRunner.withPropertyValues("spring.gson.disable-html-escaping:false").run((context) -> {
Gson gson = context.getBean(Gson.class);
assertThat(gson.htmlSafe()).isFalse();
assertThat(gson.htmlSafe()).isTrue();
});
}

Expand Down

0 comments on commit d597a4d

Please sign in to comment.