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

Tests fail on systems with non ENGLISH locale #994

Closed
DarkAtra opened this issue Jul 6, 2024 · 0 comments · Fixed by #996
Closed

Tests fail on systems with non ENGLISH locale #994

DarkAtra opened this issue Jul 6, 2024 · 0 comments · Fixed by #996
Assignees
Labels
Milestone

Comments

@DarkAtra
Copy link
Contributor

DarkAtra commented Jul 6, 2024

When running mvn clean install -Dgpg.skip=true on a system with a german locale, many tests fail with:

java.lang.NumberFormatException: For input string: "18,58"

The number in the exception messages changes randomly as it is generated by javafaker. It seems like javafaker does not respect the locale when formatting prices, see: DiUS/java-faker#433.

Possible solutions:

  • update javafaker to https://github.com/datafaker-net/datafaker (which fixes the underlying issue) - note that datafaker 2.x requires at least java 17
  • explicitly set the locale in code for all tests that depend on javafaker, like so: Locale.setDefault(Locale.ENGLISH);
  • explicitly set the locale in surefire like so:
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>${surefire.version}</version>
      <configuration>
          <argLine>@{argLine} -Duser.language=en -Duser.country=EN</argLine>
      </configuration>
    </plugin>
    
@anidotnet anidotnet self-assigned this Jul 8, 2024
@anidotnet anidotnet added this to the 4.3.1 milestone Jul 8, 2024
@anidotnet anidotnet added the bug label Jul 8, 2024
anidotnet added a commit that referenced this issue Jul 8, 2024
@anidotnet anidotnet linked a pull request Jul 8, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from To Do to Done in Nitrite 4.x Development Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

2 participants