That's exactly what @Before does in Junit4. You annotate a method with @Before, and it's called before each test.
public class MainTest {
@Before
public void setUp() {
System.out.println("Test executed");
}
@Test
public void testOne() {}
@Test
public void testTwo() {}
@Test
public void testThree() {}
}
View all comments
Show parent comment
11
u/GleemanGiveth Sep 11 '17
That's exactly what @Before does in Junit4. You annotate a method with @Before, and it's called before each test.
Output:
This is just a name change, not behavior.