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

Should assertions for properties of the superclass(es) be generated?

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
java
領域
testing, tooling

調査の方向性

まず pom.xml のジェネレーター設定と issue で参照されているドキュメントを読み、次にスーパークラスの assertion がどのように含まれているかを調べます。SomeErrorException から HttpResponseException を経て Throwable に至る例の階層を追跡し、既存の Assertions.assertThat(Throwable) の制限を確認します。既存の assertion と競合せずに継承プロパティの assertion を生成するための方針が決定され、文書化されていれば完了です。

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

説明

Consider this class:

import org.apache.http.client.HttpResponseException;

public class SomeErrorException extends HttpResponseException {
	private SomeError error;

	public SomeErrorException(int statusCode, String reason, SomeError error) {
		super(statusCode, reason);
		this.error = error;
	}

	public SomeError getError() {
		return error;
	}
}

It would be nice to be able to test SomeErrorException objects like this:

assertThat(exception).hasStatusCode(500)
                     .hasMessage("Internal Server Error")
                     .hasError(error)

However, hasStatusCode and hasMessage are not generated because they are defined in superclasses. If I include HttpResponseException in the generator configuration (in pom.xml), the hasStatusCode appear, but of course hasMessage is only present if I also include the whole hierarchy (four classes!) up to Throwable. Also, org.assertj.core.api.Assertions.assertThat(Throwable) already exists, so I cannot make my assertions a subclass (but problem with this idea are already discussed in the documentation).

Does it make sense to make it easier to include assertions for properties of superclasses?

主要言語
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 を短くまとめたダイジェスト。