目的別API使用方法(03_Tips)のコード例をJUnit 5化する - #718
Open
kumagoro1202 wants to merge 6 commits into
Open
Conversation
- 06_TestFWGuide の toctree で JUnit 5用拡張機能のページを概要の直後へ移動 - 01_Abstract の特徴「JUnit4ベース」を「JUnit 5で利用可能(推奨)+JUnit 4資産と互換」へ改訂 - 01_Abstract のテストメソッド記述方法を JUnit 5(org.junit.jupiter.api.Test)ベースへ更新 - テスティングフレームワークの入口ページに新規プロジェクト/既存プロジェクトの分岐案内を追加 - 昇格に合わせて JUnit5_Extension のページ題名を「JUnit 5での利用方法」へ変更 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- 05_UnitTestGuide/legacy_junit4: JUnit 4版コード例の入口ページを新設 - 06_TestFWGuide/legacy_junit4: JUnit 4での利用方法(継承モデルの書き方・ テスト種別と継承クラスの対応表)を新設 - 両セクションを各ガイドの toctree に追加 - 入口ページの既存プロジェクト向け案内を legacy_junit4 セクションへ誘導 既存のJUnit 4記述の本体は、各ページのJUnit 5化と合わせて順次本セクションへ 移設する(本コミットは骨格の新設のみ)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- 05_UnitTestGuide/01_ClassUnitTest 配下のコード例をJUnit 5 (@EntityTest/@DbAccessTest合成アノテーション+インジェクション方式)へ書き換え - Bean Validation対応Form/Entityクラス単体テスト - Nablarch Validation対応Form/Entityクラス単体テスト - Action/Componentクラス単体テスト - 従来のJUnit 4版(継承モデル)の3ページを legacy_junit4/ 配下へ移設 (ラベルにlegacy_junit4接頭辞を付与し、画像は既存ディレクトリを参照、 ダウンロード資材はlegacy側へ複製して自己完結化) - 各標準ページの冒頭にJUnit 4版への案内を追加 コード例のAPI(合成アノテーション+フィールドインジェクション+supportメソッド呼び出し)は nablarch-testing-junit5:2.1.0 に対して動作検証済み。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- 02_RequestUnitTest(ウェブ/REST/バッチ/メッセージング各方式)と
03_DealUnitTest(バッチ/メッセージング)のコード例を、JUnit 5の
合成アノテーション+インジェクション方式へ書き換え
- ウェブ: @BasicHttpRequestTest(baseUri=...)(getBaseUriオーバーライドを置換)
- REST: @RestTest/@SimpleRestTest(protectedメソッドはpublic版
readTextResource(Class, String)の使用を案内)
- バッチ: @BatchRequestTest、メッセージング: @MessagingRequestTest/
@MessagingReceiveTest
- JUnit 4版のテストクラス宣言パターン集を legacy_junit4/04_requestUnitTest として新設
- 誤記修正: MessagingRequestTestSupportのFQCNを実際のパッケージ
(nablarch.test.core.messaging)に合わせて修正(旧記載はnablarch.test.core.http)
- 誤記修正: 取引単体テスト(バッチ)のBatchRequestTestSupportのimport文の
パッケージをnablarch.test.core.batchへ修正
コード例のAPIは nablarch-testing-junit5:2.1.0 に対して動作検証済み
(no-arg execute()のテスト名解決は2.1.0のTestEventDispatcherExtensionの
実装で確認)。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- SystemAccountEntityTest.java / UserRegistrationFormTest.java / UserComponentTest.java を、JUnit 5の合成アノテーション (@EntityTest/@DbAccessTest)+インジェクション方式へ書き換え (ダウンロードURLは維持。JUnit 4版はlegacy_junit4/_download配下で提供継続) - 誤記修正: SystemAccountEntity.javaのパッケージ宣言を、ページ本文・ テストクラスと整合するnablarch.sample.management.userへ修正 (旧宣言nablarch.sample.ss11.entityではテストクラスとコンパイル不能だった) 検証: - UserRegistrationFormTest: nablarch-testing-junit5:2.1.0環境で実行し、 JUnit 4版と実行結果が完全一致することを確認(挙動保存の確認) - SystemAccountEntityTest / UserComponentTest: テスト対象クラス(Nablarch 5系 サンプルアプリ資材)をスタブ化した上で、テストクラス側のAPI使用を nablarch-testing 6u3 + nablarch-testing-junit5:2.1.0に対してコンパイル検証 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- テスト前後の共通処理の節をJUnit 5のアノテーション (@BeforeEach/@AfterEach/@BeforeAll/@afterall)ベースに改訂 - Excelデータ取得・ThreadContext設定・トランザクション・委譲・ プロパティ検証の各コード例を合成アノテーション+インジェクション方式へ書き換え - 「継承せずに使用したい」の節は、JUnit 5用拡張機能では継承が不要である旨を 明記した上で、委譲パターンもJUnit 5前提で維持 - JUnit 4版(@Before/@BeforeClass等の解説・委譲例)は legacy_junit4/01_tips_junit4 へ移設 - 誤記修正: プロパティ検証の実装例はexecute(String, Advice)を使用するため、 使用クラスをHttpRequestTestSupportからBasicHttpRequestTestTemplateへ修正 (旧例の継承クラスにはexecute(String, Advice)が存在せずコンパイル不能だった) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
06_TestFWGuide/03_Tipsのコード例をJUnit 5前提へ改訂します。
誤記修正:
マージ順序について: 本PRはスタックPRであり、先行PR 1-5(
junit5-docs/1-5-download-samples)までの内容を含みます。マージ順序は 1-1 → 1-2 → 1-3 → 1-4 → 1-5 → 1-6 → 1-7 → 1-8 を厳守してください。先行PRがマージされるまで、本PRの差分表示には先行PR分の変更が含まれます。