Jackson-Core 版本 2.11.2 的单元测试失败

Unit test failure on building of Jackson-Core Version 2.11.2

在使用最新版本 2.11.2 手动构建 jackson-core 模块的过程中,我在单元测试中遇到错误;我假设这是由于我的笔记本电脑上的设置问题。

执行的步骤:

  1. Java 版本 -> 1.8
  2. 克隆 jackson-core 仓库
  3. git checkout tags/jackson-core-2.11.2
  4. mvn package

结果:

[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in com.fasterxml.jackson.core.type.TypeReferenceTest
[INFO] Running com.fasterxml.jackson.core.util.ByteArrayBuilderTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 s - in com.fasterxml.jackson.core.util.ByteArrayBuilderTest
[INFO] Running com.fasterxml.jackson.core.util.DefaultIndenterTest
[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.006 s <<< FAILURE! - in com.fasterxml.jackson.core.util.DefaultIndenterTest
[ERROR] testWithIndent(com.fasterxml.jackson.core.util.DefaultIndenterTest)  Time elapsed: 0.002 s  <<< FAILURE!
org.junit.ComparisonFailure:
expected:<[]
] but was:<[
>
        at com.fasterxml.jackson.core.util.DefaultIndenterTest.testWithIndent(DefaultIndenterTest.java:32)

[INFO] Running com.fasterxml.jackson.core.util.RequestPayloadTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 s - in com.fasterxml.jackson.core.util.RequestPayloadTest
[INFO] Running com.fasterxml.jackson.core.util.SeparatorsTest
....
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   DefaultIndenterTest.testWithIndent:32 expected:<[]
] but was:<[
>
[INFO]
[ERROR] Tests run: 895, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[ERROR] There are test failures.

问题: 我想知道笔记本电脑上的什么设置可能导致单元测试失败?

查看他们的 code, specially at the specific unit test,他们正在将 \nEol 进行比较。 我相信您看到的错误可能与您 运行 所在的 OS 有关,因为它们之间可能有所不同。