-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Use configured locale for SSE displayState #3069
Conversation
Signed-off-by: Anders Alfredsson <andersb86@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, can you add a test that ensures this will not break again? It should ensure that the locale returned by the LocaleService
is different from the system-locale and then check that the display state is in the correct format.
I've only ever done simple unit tests unfortunately, not sure how I would go about testing something like this, with so many different parts I'm afraid. If I understand it correctly, it would require a mocked Thing with stateOptions defined for a channel, (in two different languages), an Item connected to that channel, plus configuring the I18nProviderImpl (the default LocaleProvider), and finally calling SseItemStatesEventBuilder.buildEvent(), to check that the correct language is used? I honestly have no idea how to even begin, but if I could get some guidance I would be happy to learn more about it. |
I think you can mock everything. If you
|
Ok, please bear with me trying to get my head around this.
But if I mock this in the Item I thereby make the assumption that the StateDescriptionService part also works, which means the only thing the test will prove is that this method actually gets called. Maybe I'm misunderstanding the purpose of testing, but I can't really see that this proves anything useful? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, we'll see if it breaks again.
Signed-off-by: Anders Alfredsson <andersb86@gmail.com> Signed-off-by: Anders Alfredsson <andersb86@gmail.com> GitOrigin-RevId: 80794bf
Fixes #3067
Signed-off-by: Anders Alfredsson andersb86@gmail.com