Skip to content
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

testPercentageReplacer fails #7

Open
oliverskawronek opened this issue May 17, 2018 · 2 comments
Open

testPercentageReplacer fails #7

oliverskawronek opened this issue May 17, 2018 · 2 comments

Comments

@oliverskawronek
Copy link

oliverskawronek commented May 17, 2018

The PercentageReplacer executes

return String.format("%6.2f", progress.getPercentage() * 100);

I'am using german locale on my machine, and in german we use a comma instead of a point as decimal separator (unfortunately this is a common issue). The test against " 0.00" (with dot) fails due to the actual string is " 0,00" (with comma).

You can fix this by passing a explicit locale that is using a dot as decimal separator:

return String.format(Locale.US, "%6.2f", progress.getPercentage() * 100);

For more details please have a look on SO: https://stackoverflow.com/questions/5236056/force-point-as-decimal-separator-in-java

@raszi
Copy link
Owner

raszi commented May 26, 2018

Great catch, thanks for reporting

@raszi
Copy link
Owner

raszi commented Feb 4, 2021

Probably it would be better to fix the test instead of hardcoding the locale in the codebase. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants