spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.43k stars 38.07k forks source link

Enforce using BDDMockito #32077

Closed quaff closed 8 months ago

quaff commented 8 months ago

There are lots of codes that mixing usage of BDD-style and traditional Mockito API, and keep increasing , I think it's necessary to enforce using BDDMockito, If the team decide to align with Spring Boot, I would like to submit an PR.

snicoll commented 8 months ago

I think it's necessary to enforce using BDDMockito

Thanks for the suggestion, @quaff. Why do you think it is necessary to enforce using BDDMockito?

quaff commented 8 months ago

FWIW I also find this mixed usage of BDD-style and traditional Mockito APIs to be rather confusing and unintuitive.

https://github.com/spring-projects/spring-boot/pull/29178#issuecomment-1002941378

snicoll commented 8 months ago

I am not denying that harmonization is good, I was asking you why you think that BDDMockito should be enforced. I know what the Spring Boot team did as I am sure you are aware but that doesn't mean that all teams have the same preferences.

quaff commented 8 months ago

I was asking you why you think that BDDMockito should be enforced.

I also find this mixed usage of BDD-style and traditional Mockito APIs to be rather confusing and unintuitive.

but that doesn't mean that all teams have the same preferences.

Let's here from others of team.

bclozel commented 8 months ago

We already have a few rules enforced with our checkstyle configuration. Even these rules can be cumbersome in my opinion, as if I'm not mistaken the BDD-style doesn't allow to mock methods returning void and that doThrow is "forbidden".

I'm all for consistency, but I think our current arrangement works and that enforcing new rules would create a lot of consistency work for not so much benefit. Improving our test coverage or working on the issue backlog are higher priorities for me right now.

I'm in favor of declining this proposal.

sdeleuze commented 8 months ago

Mostly same feedback than Brian, and I am myself not fully convince yet we should use the BDD-style everywhere (more a matter of taste I guess).