For example, we have 2 classes: BaseTest
and Test
; Test
extends BaseTest
.
BaseTest.class
contains 2 methods with @BeforeEach
annotations.
@BeforeEach
void setUp1() {}
@BeforeEach
void setUp2() {}
Test.class
contains 2 methods with @Test
annotations.
@Test
void test1() {}
@Test
void test2() {}
I want to link the @BeforeEach
method with @Test
method, so the setup1()
would run only before test1()
and the setup2()
- only before test2()
.
I would appreciate a code sample of this task completed using JUnit extensions.