Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-2881

Fix failing tests when build runs with OpenJDK in non-english locale

XMLWordPrintable

    • Hide

      Set machine's locale to de_DE.

      Run 'mvn verify'.

      Show
      Set machine's locale to de_DE. Run 'mvn verify'.
    • NEW
    • NEW

      Observed behavior:

      OpenJDK Temurin (and I guess many other JDKs) uses Apache Xerces internally for XML parsing, which in turn uses localized exception messages.

      When building Optaplanner in non-english locale, e.g. de_DE, the following tests fail, because they validate the message of thrown SAXParseExceptions and expect english text:

      • GenericJaxbIOTest
      • PlannerBenchmarkConfigTest
      • SolverConfigTest

       

      Expected behavior:

      Tests should not rely on exception messages that are subject to locale.

      As an alternative, tests could verify parts of the stacktrace that are not message text, such as the class of the exception or (in the given tests with SAXParseException) the fields that caused the parser to throw the exception.

              lpetrovi@redhat.com Lukáš Petrovický (Inactive)
              thimmwork Marcel Thimm (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: