Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Outdated
-
None
-
None
-
None
Description
In quite a lot of unit tests you see the following pattern:
@Before public void setUp() throws Exception { super.setUp(); ...
The order in which @Before method are called is defined such that @Before in base classes is called before sub classes, see also this StackOverflow discussion (link).
A best practice that I'd like to introduce is to use final public void ... for @Before methods so sub classes don't accidentally hide an @Before of a base class.