单元测试在构建Jackson-Core 2.11.2版本时失败。

huangapple go评论76阅读模式
英文:

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] 运行测试: 3个,失败: 0个,错误: 0个,跳过: 0个,耗时: 0.004秒 - 位于 com.fasterxml.jackson.core.type.TypeReferenceTest
[INFO] 运行测试: 1个,失败: 0个,错误: 0个,跳过: 0个,耗时: 0.005秒 - 位于 com.fasterxml.jackson.core.util.ByteArrayBuilderTest
[INFO] 运行测试: 2个,失败: 1个,错误: 0个,跳过: 0个,耗时: 0.006秒 <<< 失败!- 位于 com.fasterxml.jackson.core.util.DefaultIndenterTest
[ERROR] testWithIndent(com.fasterxml.jackson.core.util.DefaultIndenterTest)  耗时: 0.002秒  <<< 失败!
org.junit.ComparisonFailure:
期望值: <[]
但实际值: <[
] >
        位于 com.fasterxml.jackson.core.util.DefaultIndenterTest.testWithIndent(DefaultIndenterTest.java:32)

[INFO] 运行测试: 4个,失败: 0个,错误: 0个,跳过: 0个,耗时: 0.007秒 - 位于 com.fasterxml.jackson.core.util.RequestPayloadTest
[INFO] 运行测试: ...(部分内容省略)
[INFO]
[INFO] 结果:
[INFO]
[ERROR] 失败项:
[ERROR]   DefaultIndenterTest.testWithIndent:32 期望值: <[] 但实际值: <[
] >
[INFO]
[ERROR] 运行测试: 895个,失败: 1个,错误: 0个,跳过: 0个
[INFO]
[ERROR] 存在测试失败。

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

英文:

In the process of manually building the jackson-core module using the latest version of 2.11.2 I am encountering an error in the unit tests; which I'm assuming is due to a setting issue on my laptop.

Steps Performed:

  1. Java Version -> 1.8
  2. clone jackson-core repo
  3. git checkout tags/jackson-core-2.11.2
  4. mvn package

Result:

[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 &lt;&lt;&lt; FAILURE! - in com.fasterxml.jackson.core.util.DefaultIndenterTest
[ERROR] testWithIndent(com.fasterxml.jackson.core.util.DefaultIndenterTest)  Time elapsed: 0.002 s  &lt;&lt;&lt; FAILURE!
org.junit.ComparisonFailure:
expected:&lt;[]
] but was:&lt;[
&gt;
        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:&lt;[]
] but was:&lt;[
&gt;
[INFO]
[ERROR] Tests run: 895, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[ERROR] There are test failures.

Question:
I was wondering what setting could be wrong on the laptop that is causing the failure in the Unit tests?

答案1

得分: 0

查看他们的代码,特别是那个特定的单元测试,他们将\n视为Eol(行尾结束符)进行比较。
我认为你看到的错误可能与你所使用的操作系统有关,因为在不同操作系统之间可能会有差异。

英文:

Looking at their code, specially at the specific unit test, they are comparing \n as the Eol.
I believe the error you are seeing could be related to the OS you are running on as it might differ between them.

huangapple
  • 本文由 发表于 2020年9月17日 22:26:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/63940223.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定