Polish "Fix parameter replacement when message matches its code"
See gh-45212
This commit is contained in:
parent
83901a22b6
commit
9c5e608f50
|
@ -62,8 +62,21 @@ class MessageSourceMessageInterpolatorTests {
|
|||
void interpolateWhenParametersAreUnknownUsingCodeAsDefaultShouldLeaveThemUnchanged() {
|
||||
this.messageSource.setUseCodeAsDefaultMessage(true);
|
||||
this.messageSource.addMessage("top", Locale.getDefault(), "{child}+{child}");
|
||||
assertThat(this.interpolator.interpolate("{foo}{top}{bar}", this.context))
|
||||
.isEqualTo("{foo}{child}+{child}{bar}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void interpolateShouldReplaceParameterThatReferencesAMessageThatMatchesItsCode() {
|
||||
this.messageSource.addMessage("foo", Locale.getDefault(), "foo");
|
||||
assertThat(this.interpolator.interpolate("{foo}{top}{bar}", this.context)).isEqualTo("foo{child}+{child}{bar}");
|
||||
assertThat(this.interpolator.interpolate("{foo}", this.context)).isEqualTo("foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
void interpolateUsingCodeAsDefaultShouldReplaceParameterThatReferencesAMessageThatMatchesItsCode() {
|
||||
this.messageSource.setUseCodeAsDefaultMessage(true);
|
||||
this.messageSource.addMessage("foo", Locale.getDefault(), "foo");
|
||||
assertThat(this.interpolator.interpolate("{foo}", this.context)).isEqualTo("foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue