apache / apache/parquet-java

Introduce AssertJ for testing

未关闭
#3,615 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Type: enhancement
主要语言
Java
星标
3.1k
派生
1.6k
平均合并
3 天 12 小时
30 天内合并 PR
33

描述

Describe the enhancement requested

AssertJ gives us readable, fluent assertions that make tests easier to write and failures easier to analyze. With JUnit's assertEquals(expected, actual) it's easy to mix up argument order, and you end up with confusing failure messages. AssertJ's assertThat(actual).isEqualTo(expected) reads naturally and always gets the order right. Additionally, it provides a lot of flexibility when asserting things.

Compound checks that need multiple JUnit assertions collapse into a single chain:

// JUnit
assertNotNull(list);
assertEquals(3, list.size());
assertTrue(list.contains("foo"));
// AssertJ
assertThat(list).hasSize(3).contains("foo");

When something fails, AssertJ tells you exactly what went wrong and makes debugging much easier, because the failure message usually contains enough details to understand the issue. For example, an assertion on a list would fail with expected list to contain 'foo' but was ['bar', 'baz']. JUnit assertions on the other hand would only contain expected true but was false.

It also covers cases where JUnit assertions are just clunky: exception messages, collection contents, map entries, string patterns, comparisons with custom comparators. All without needing Hamcrest matchers or custom helper methods.

I'm planning to add it as a project-wide test dependency so new tests can use it immediately. Existing tests don't need to be migrated, and we can move them over incrementally where it makes sense.

Component(s)

No response

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

未指定文件或测试。首先定位整个项目的测试依赖配置,并检查现有测试依赖是如何声明的;完成的标准是:新测试可以使用 AssertJ,而无需迁移现有测试,并且项目的测试构建通过。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
testing
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
62/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。