generate_test_cases
Generate a complete JUnit 5 and Mockito test class for one Java class, with @DisplayName annotations for readable test reports. Call once per class.
Instructions
Generate a complete JUnit 5 + Mockito test class for one Java class, with @DisplayName annotations on every test class, nested group, and test method for readable test reports. Follows Comviva standards (copyright header, package layout). Call once per class; for 'tests for all classes in the project', the host LLM should glob the sources and invoke this tool per file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| className | Yes | Fully-qualified or simple class name of the class under test (SUT), e.g. 'MenuService' or 'com.comviva.menuservice.service.MenuService'. | |
| sourceCode | Yes | Full Java source of the class under test. The generator reads this to derive collaborators, method signatures, branches, and exception paths. | |
| useAssertJ | No | Use AssertJ (assertThat) for assertions. If false, falls back to JUnit 5 assertions. | |
| coverageTargets | No | Optional list of method names or scenarios that MUST be covered. Use when a specific branch isn't obvious from the source. | |
| packageOverride | No | Override the test package. Default: same package as SUT under src/test/java. | |
| includeIntegrationTest | No | Also produce a Spring-context integration test (*IT.java suffix) using @SpringBootTest. Off by default — most classes only need unit tests. |