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.
Diese Ressource ist nur auf Englisch verfügbar.
Prompts sind Text, den du in deinen eigenen Assistenten kopierst. KitLocal führt sie nicht aus.
Variablen ausfüllen
Was du eingibst, bleibt in diesem Browser. Es wird weder zur URL hinzugefügt noch gespeichert oder irgendwohin gesendet.
Vorschau
Noch erforderlich: 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}}
```
Zweck
Draft a first, reviewable test class so you start from a solid skeleton instead of a blank file.
Wann man es einsetzt
- A class has little or no coverage and you need a starting point.
- You want edge cases you might not think of listed explicitly.
Was du vorbereiten solltest
- The class under test and the signatures of its direct collaborators.
- Your assertion library preference.
Erwartete Ausgabe
A single compilable Java test class in one code block, followed by a short "Not covered" list.
Über diesen Katalog
Mitgelieferter Snapshot · veröffentlicht 15.11.2026, 06:05 · Katalogversion 5bc079fe355af2214bc0
Es wird der mit der App gelieferte Snapshot angezeigt (keine Inhaltsquelle konfiguriert). An der Quelle könnten neuere Inhalte vorliegen.