Although we have a Checkstyle rule which attempts to enforce the use of BDDMockito
...
https://github.com/spring-projects/spring-framework/blob/ce815006d23891cc4eb7b098fe00fa51114a684f/src/checkstyle/checkstyle.xml#L223-L229
... that rule does not actually enforce anything.
For example, it's still possible to statically import methods declared in Mockito
via BDDMockito
, and that has happened numerous times across the code base.
import static org.mockito.BDDMockito.doThrow;
import static org.mockito.BDDMockito.mock;
import static org.mockito.BDDMockito.times;
import static org.mockito.BDDMockito.verify;
import static org.mockito.BDDMockito.when;
import static org.mockito.BDDMockito.willAnswer;
During a team discussion, we decided that the team currently has no preference regarding BDDMockito
stubbing APIs over traditional Mockito
stubbing APIs. In addition, certain IDEs (for example, Eclipse) covert static imports for org.mockito.BDDMockito.when
to org.mockito.Mockito.when
which then fails the Gradle build even though the latter import is technically more correct.
In light of that, we have decided to simply remove the BDDMockito
Checkstyle rule.