Create template files under prompts/templates directory, like:

  • Java language:,,
  • Kotlin language: ControllerTest.kt, ServiceTest.kt, Test.kt

when generate test file, will use these templates.

For example:

// You should use follow @SpringBootTest with RANDOM_PORT for the web environment, or you test will be failed.
// You should use @ExtendWith(SpringExtension::class) for the test class.
// For example:
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class /* Here some be {ControllerName} */ControllerTest {
    private lateinit var mockMvc: MockMvc

    // other some mock beans

    fun setup() {
        mockMvc = MockMvcBuilders.standaloneSetup(/* {ControllerName} */Controller(/* some mock beans */)).build()

    // the test methods