monitorjbl / excel-streaming-reader

An easy-to-use implementation of a streaming Excel reader using Apache POI
Apache License 2.0
943 stars 342 forks source link

Tests are locale dependent #232

Open rimuln opened 3 years ago

rimuln commented 3 years ago

Algouth classes set in BeforeAll method Locale.setDefault(Locale.ENGLISH) 2 tests are failing due actual values in differet language.

Tested on our company machnine with German system locale and my developer machine with Czech locale.

Test output is:

com.monitorjbl.xlsx.StreamingReaderTest.testSpecialStyles()  Time elapsed: 0.023 sec  <<< FAILURE!
java.lang.AssertionError:
Expected: "Thu\", \"Dec 25\", \"14"
     but: was "Ŕt\", \"pro 25\", \"14"
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
        at com.monitorjbl.xlsx.StreamingReaderTest.testSpecialStyles(StreamingReaderTest.java:486)

and:

Tests run: 8, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.176 sec <<< FAILURE!
com.monitorjbl.xlsx.StreamingWorkbookTest.testNumericFormattedFormulaCell()  Time elapsed: 0.022 sec  <<< FAILURE!
org.opentest4j.AssertionFailedError: Cell Sheet1!C2 has wrong string content. ==> expected: <May 11 2018> but was: <kvýtna 11 2018>
        at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
        at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
        at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1135)
        at com.monitorjbl.xlsx.TestUtils.expectStringContent(TestUtils.java:30)
        at com.monitorjbl.xlsx.StreamingWorkbookTest.testNumericFormattedFormulaCell(StreamingWorkbookTest.java:136)