For my tests I'm using a base class MyTestBase
defining a method setup()
that does some base preparations:
public class MyTestBase {
@Configuration( beforeTestMethod=true )
protected void setup() {
// do base preparations
}
}
Now I have some more specific test classes that have to do their own preparations. There are different ways how to implement this.
I could use @Override
:
public class MySpecialTestBase extends MyTestBase {
@Override
protected void setup() {
super.setup();
// do additional preparations
}
}
...or I could use a separate setup method:
public class MySpecialTestBase extends MyTestBase {
@Configuration( beforeTestMethod=true )
protected void setupSpecial() {
// do additional preparations
}
}
Is there a prefered way to implement this?