You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The two tests mentioned before are not working on the JRE with a non-English default locale. Cause: because in the given number format in the first test, only the pattern is set, but no locale is given, the default locale is used (see the standard description for annotation). In the case of the non-English default locale, the result JSON string could be different from the constant used in the test. Therefore, this test fails.
In the second test, there is no number formatting used because the standard doesn't give us the possibility to do so with the builder's configuration, not with annotation. There is still a question, why is it so in the standard? But aside from this, this test also only works on the installations with English as the default locale. This time, one uses the class without formatting to serialize and with formatting to deserialize. This also fails with non-English locales.
So there are two possibilities for the first test: either set both the pattern and locale in the annotations. Or respect the current default locale in the expected JSON string.
For the second test, there is only one solution: one should use the same class for serialization and deserialization. It is also a scenario that would work in the productive system: it would be hard to serialize and deserialize with such differently configured classes.
To Reproduce
Run the tests mentioned before.
Expected behavior
Tests not to fail.
System information:
OS: Linux
Java Version: 17.0.9
Yasson Version: 3.0.3
Additional context
I'll create a PR with the second solution.
The text was updated successfully, but these errors were encountered:
Describe the bug
The two tests mentioned before are not working on the JRE with a non-English default locale. Cause: because in the given number format in the first test, only the pattern is set, but no locale is given, the default locale is used (see the standard description for annotation). In the case of the non-English default locale, the result JSON string could be different from the constant used in the test. Therefore, this test fails.
In the second test, there is no number formatting used because the standard doesn't give us the possibility to do so with the builder's configuration, not with annotation. There is still a question, why is it so in the standard? But aside from this, this test also only works on the installations with English as the default locale. This time, one uses the class without formatting to serialize and with formatting to deserialize. This also fails with non-English locales.
So there are two possibilities for the first test: either set both the pattern and locale in the annotations. Or respect the current default locale in the expected JSON string.
For the second test, there is only one solution: one should use the same class for serialization and deserialization. It is also a scenario that would work in the productive system: it would be hard to serialize and deserialize with such differently configured classes.
To Reproduce
Run the tests mentioned before.
Expected behavior
Tests not to fail.
System information:
Additional context
I'll create a PR with the second solution.
The text was updated successfully, but these errors were encountered: