I understand that there are @Before and @BeforeClass, which are used to define fixtures for the @Test‘s. But what should I use if I need different fixtures for each @Test?
- Should I define the fixture in the
@Test? - Should I create a test class
for each@Test?
I am asking for the best practices here, since both solutions aren’t clean in my opinion. With the first solution, I would test the initialization code. And with the second solution I would break the “one test class for each class” pattern.
Tips: