OWASP-Benchmark / BenchmarkUtils

OWASP Benchmark Project Utilities - Provides scorecard generation and crawling tools for Benchmark style test suites.
https://owasp.org/www-project-benchmark/
GNU General Public License v3.0
13 stars 48 forks source link

fix: mvn install fails on Windows #54

Closed viszkoktamas closed 9 months ago

viszkoktamas commented 9 months ago

Running mvn install fails on windows PCs because of different line endings.

This PR fixes that issue.

example error:

``` [ERROR] org.owasp.benchmarkutils.score.ConfigurationTest.informsAboutResourceConfig -- Time elapsed: 0.003 s <<< FAILURE! org.opentest4j.AssertionFailedError: expected: but was: at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151) at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132) at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141) at org.owasp.benchmarkutils.score.ConfigurationTest.informsAboutResourceConfig(ConfigurationTest.java:95) at java.lang.reflect.Method.invoke(Method.java:498) at java.util.ArrayList.forEach(ArrayList.java:1259) at java.util.ArrayList.forEach(ArrayList.java:1259) ``` <\details>
davewichers commented 9 months ago

Thanks for this. Just to be clear, this should work on all platforms: Mac, Linux, Windows, etc. right? Looks like it should, but just wanted to make sure.

viszkoktamas commented 9 months ago

Yes, this change is replacing hardcoded "\n" character to the line ending used by the running OS, so it should work on all systems. I've tried it on windows, CI job succeeded, so it works on linux, and I did not try it on mac, but it must be okay there also.