-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BindAdviceTraitTest's test failure. message is not following locale(English) setting. #905
Comments
Is spring using that locale holder for bean validation?
…On Fri, 14 Apr 2023, 12:50 arthur.yoon, ***@***.***> wrote:
Description
In the BindAdviceTraitTest class, when the locale is set to English by
LocaleContextHolder.setLocale(Locale.ENGLISH) in the setUp method with
BeforeEach, problem.getViolations().get(*).getMessage() is output in Korean
according to my locale instead of English.
Expected Behavior
problem.getViolations().get(
*).getMessage() is "size must be between 3 and 10".
problem.getViolations().get(*).getMessage() is "must be greater than or
equal to 0".
Actual Behavior
problem.getViolations().get(
*).getMessage() is "크기가 3에서 10 사이여야 합니다" problem.getViolations().get(*).getMessage()
is "0 이상이어야 합니다"
[image: image]
<https://user-images.githubusercontent.com/47406496/232022814-82e3b277-4f5c-4e96-ab90-7a6f71e803a3.png>
Possible Fix Steps to Reproduce
1.
2.
3.
4.
Context Your Environment
- Version used: 0.29.0-SNAPSHOT
- Link to your project: nothing changed yet. just test case failures
—
Reply to this email directly, view it on GitHub
<#905>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADI7HK5IW2KDTBEFLPVTS3XBETWDANCNFSM6AAAAAAW6IJZNI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I at least experience the same with my laptop being set to German, so I also get issues with the test execution. |
it's not enough to call LocaleContextHolder.setLocale(Locale.ENGLISH), which sets the Locale information used by Spring. |
It's correct to use English as the message source instead of changing the locale setting, but I don't think this is a good idea, because if the message.properties are changed, the test case will eventually break. Shouldn't we modify it to something other than testing if the sentences match? |
is this issue handled? |
Description
In the BindAdviceTraitTest class, when the locale is set to English by LocaleContextHolder.setLocale(Locale.ENGLISH) in the setUp method with BeforeEach, problem.getViolations().get(*).getMessage() is output in Korean according to my locale instead of English.
Expected Behavior
problem.getViolations().get().getMessage() is "size must be between 3 and 10".
problem.getViolations().get().getMessage() is "must be greater than or equal to 0".
Actual Behavior
problem.getViolations().get().getMessage() is "크기가 3에서 10 사이여야 합니다"
problem.getViolations().get().getMessage() is "0 이상이어야 합니다"
Possible Fix
Steps to Reproduce
Context
Your Environment
The text was updated successfully, but these errors were encountered: