Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

The generator is a little too greedy with Iterable of Path and make tests fails

オープン
#115 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java
領域
tooling

調査の方向性

まず、リンク先の assertj-foo.zip サンプルを展開し、FooTest を実行して失敗する hasPath アサーションを再現します。java.lang.Iterable を実装する型をジェネレーターがどのように処理するかを、java.util.Collection との違いを含めて追跡します。Path に類似した Iterable 型が等価性セマンティクスを使用し、Collection 型がコレクション述語を維持したまま、テストが成功すれば完了です。

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

説明

With 2.1.0 version, the generator is too greedy when encountering a class implementing an java.lang.Iterable. It should ignore it unless the type extends java.util.Collection (where that make sense) or explicitly a java.lang.Iterable (where it is harder to tell it makes sense).

Sample classes: assertj-foo.zip

The test (FooTest) will fail because the usage of hasPath is NOT the same than using an iterable: we want to test an equals rather than a collection predicate. Here the exception: java.lang.AssertionError: Expecting: <foobar\a>to contain: <[foobar\a]>but could not find: <[foobar\a]>

A working alternative is to convert the Path into a List extracting the Iterable content, but that is wrong by all means:

  • first, the default semantic is not good (the default = search for subsequence in any order)
  • second, as an user, I want to test the path using equals (and that is what the generator produce if I have a class not implementing java.lang.Iterable):
final List<Path> paths = new ArrayList<>();
test.forEach(paths::add); // says ["foobar", "A"]
assertThat(foo).hasPath(paths);
主要言語
Java
スター
72
フォーク
47
PR マージ指標
30日以内にマージされた PR はありません

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

assertj/assertj-generator のほかの issue

assertj/assertj-generator の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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