Write JUnit 5 tests for a Java class
Generates a focused JUnit 5 test class (with Mockito when needed) for one class, covering the happy path, edge cases and failure modes, and explains what it did not cover.
此資源僅提供英文版本。
提示詞是你複製到自己助理中的文字。KitLocal 不會執行它們。
填寫變數
你輸入的內容只保留在此瀏覽器中,不會加入 URL、儲存或傳送到任何地方。
預覽
仍需填寫:Class under test
Write a JUnit 5 test class for the Java class below.
Assertion style: AssertJ
Use Mockito for collaborators: yes
Rules:
- One behavior per test; name tests as should_<behavior>_when_<condition>.
- Cover the happy path, boundary values, null/empty input, and each exception path.
- Do not test private methods directly and do not assert on implementation details.
- Prefer small inline fixtures over shared mutable state.
- After the code, list behaviors you deliberately did NOT test and why.
Collaborators:
Class under test:
```java
{{classUnderTest}}
```
用途
Draft a first, reviewable test class so you start from a solid skeleton instead of a blank file.
適用時機
- A class has little or no coverage and you need a starting point.
- You want edge cases you might not think of listed explicitly.
需要準備的內容
- The class under test and the signatures of its direct collaborators.
- Your assertion library preference.
預期輸出
A single compilable Java test class in one code block, followed by a short "Not covered" list.
關於此目錄
內建快照 · 發布於 2026年11月15日 清晨6:05 · 目錄修訂版 5bc079fe355af2214bc0
正在顯示應用程式內建的快照(尚未設定內容來源)。來源處可能已有更新的內容。