Saturday, 29 April 2017

IntelliJ: Live Template for generating an empty JUnit test method

Here's an IntelliJ / Android Studio Live Template for generating an empty JUnit test method:

@org.junit.Test
public void $testMethodName$() {
    // Given.
    
    // When.
    
    // Then.
}

Set the "Applicability" of the Live Template to be "Java declarations" and set the "Expression" associated to the $testMethodName$ variable to be methodName().

Set the "Abbreviation" and "Description" for the Live Template as you wish and that's it... you're good to go!

No comments: