Annotate it

Report a typo

Methods of this test class lack proper annotations:

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
internal class SampleTests {

    @BeforeAll // 1.
    fun setup() {
        println("Executes before anything else")
    }

    // 2.
    fun teardown() {
        println("Executes after everything else")
    }
    
    // 3.
    fun instantiate() {
        println("Executes before a test method")
    }

    @AfterEach
    fun  // 4.
            cleanup() {
        println("Executes after a test method")
    }

    // 5.
    fun testSomething() {
        println("Performs a test")
    }
}

Let's fix it! Write the missing annotations for positions 2, 3, and 5. Write each annotation in a new line and remember that they are case sensitive.

Example:

@BeforeAll
@BeforeEach
@Test
Enter a short text
___

Create a free account to access the full topic