Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.
Merged
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 @@ -58,6 +58,8 @@ public JsonMessageSource(ConfigurationPropertiesBean config) {
this.config = config;
}



@Override
protected MessageFormat resolveCode(String code, Locale locale) {

Expand All @@ -73,7 +75,7 @@ protected MessageFormat resolveCode(String code, Locale locale) {

if (value == null) {
// if it's still null, return null
return null;
return new MessageFormat(code, locale);
} else {
// otherwise format the message
return new MessageFormat(value, locale);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public void verifyWhenLocaleExists_canResolveCode() {

@Test
public void verifyWhenLocaleDoesNotExist_cannotResolveCode() {
String code = "test";
MessageFormat mf = jsonMessageSource.resolveCode("test", localeThatDoesNotHaveAFile);
assertNull(mf);
assertEquals(code, mf.toPattern());
}
}