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.
Questa risorsa è disponibile solo in inglese.
I prompt sono testo che copi nel tuo assistente. KitLocal non li esegue.
Compila le variabili
Quello che scrivi resta in questo browser. Non viene aggiunto all’URL, salvato né inviato da nessuna parte.
Anteprima
Ancora necessario: 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}}
```
Scopo
Draft a first, reviewable test class so you start from a solid skeleton instead of a blank file.
Quando usarlo
- A class has little or no coverage and you need a starting point.
- You want edge cases you might not think of listed explicitly.
Cosa preparare
- The class under test and the signatures of its direct collaborators.
- Your assertion library preference.
Output atteso
A single compilable Java test class in one code block, followed by a short "Not covered" list.
Informazioni su questo catalogo
Istantanea inclusa · pubblicato 15 nov 2026, 06:05 · Revisione del catalogo 5bc079fe355af2214bc0
Viene mostrata l’istantanea inclusa nell’app (nessuna fonte di contenuti configurata). Alla fonte potrebbero esserci contenuti più recenti.