apache / apache/parquet-java

Introduce AssertJ for testing

オープン
#3,615 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: enhancement
主要言語
Java
スター
3.1k
フォーク
1.6k
平均マージ
3日 12時間
マージ済み PR(30日)
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_

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

ファイルやテストは指定されていません。まずプロジェクト全体のテスト依存関係の設定を見つけ、既存のテスト依存関係がどのように宣言されているかを確認してください。既存のテストを移行せずに新しいテストで AssertJ を利用でき、プロジェクトのテストビルドが成功すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
testing
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
62/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。