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

Unit test XslUtilTest.testHtml2textSubstituteHtmlToTextLayoutElement fails on Windows. #8517

Open
Desharin opened this issue Nov 26, 2024 · 1 comment

Comments

@Desharin
Copy link

Describe the bug
When building GeoNetwork 4.2.11 and running the unit tests, the test XslUtilTest.testHtml2textSubstituteHtmlToTextLayoutElement fails only on Windows machines. The following error is given:
[ERROR] Failures: [ERROR] XslUtilTest.testHtml2textSubstituteHtmlToTextLayoutElement:47 expected:<Sample text[ Sample text 2] Sample text 3> but was:<Sample text[ ]ample text 2 Sample text 3>

This unit test tries to substitute the following html <div><span>Sample text</span><br/><span>Sample text 2</span><br/><span>Sample text 3</span></div>, but before passing it to the html parser it replaces all <br/> elements with System.getProperty("line.separator"). On Unix machines this is \n, but on Windows it's \r\n. I'm not entirely sure how or why this causes problems further down the line, but it makes the unit test fail and halts the generation build process.
The function can be found here.

To Reproduce
Steps to reproduce the behavior:

  1. Checkout tags/4.2.11 to your Windows machine.
  2. Run mvn clean install -Penv-prod
  3. Maven throws an error on the unit tests.

Expected behavior
All unit tests to pass and complete the build.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 11
  • GeoNetwork Version: 4.2.11
  • Server Application: Java 8.
@tobias-hotz
Copy link
Contributor

FYI: This is not the only issue on windows currently.
There is a PR to fix various broken tests and other code paths on windows: #8355

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