mercredi 27 novembre 2019

How to add test method's comment sections from IntelliJ automatically?

I am creating test classes from the IntelliJ automatically like following

CreateTest

This gives me the test class as following in the appropriate module accordingly:

public class MyClassTest {
    @Test
    public void myMethod() {
    }
}

What I am looking for is that

Does IntelliJ can automatically insert Given When Then comment sections into test methods?

I am searching for something like following:

public class MyClassTest {
    @Test
    public void myMethod() {
        // Given
        // When
        // Then
    }
}

These sections are useful for the reader coming after some times passed but usually missed while writing test methods. I am looking for a solution to add this behavior to IDE.

Aucun commentaire:

Enregistrer un commentaire