A test template for JUnit tests doesn't exist out of the box for IntelliJ IDEA. Creating one is not complicated.

The goal is to create a simple template that will assist you when you need to write a test in JUnit. I want it to look something like this:

@Test
public void should_assert_a_behaviour() {
    // Given
    // Setup the system under test

    // When
    // Execute the system under test

    // Then
    // Assert that the expected change has occurred
}

To add it follow, these steps:

Done!

To use the new template, just press cmd j or ctrl j (depending on your os) and select 'test'.

Resources