GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
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:
Checkout tags/4.2.11 to your Windows machine.
Run mvn clean install -Penv-prod
Maven throws an error on the unit tests.
Expected behavior
All unit tests to pass and complete the build.
Screenshots
Desktop (please complete the following information):
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 withSystem.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:
mvn clean install -Penv-prod
Expected behavior All unit tests to pass and complete the build.
Screenshots
Desktop (please complete the following information):