spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.91k stars 40.62k forks source link

Checkstyle is not catching Mockito.when #20902

Closed philwebb closed 4 years ago

philwebb commented 4 years ago

Called to Mockito.when should fail, but a few have somehow snuck in.

philwebb commented 4 years ago

E.g. HazelcastHealthIndicatorTests.

mbhave commented 4 years ago

@philwebb I couldn't find any usages of Mockito.when. HazelcastHealthIndicatorTests is using BDDMockito.when.

philwebb commented 4 years ago

Ahh, that explains it. There isn't a BDDMockito.when static method, it's picking it up because BDDMockito extends Mockito and there's a Mockito.when. Really we should bad static references like that.

Eclipse has a cleanup rule call "Change all access though subtype" which gets applied. If I did a cleanup on HazelcastHealthIndicatorTests it would change BDDMockito.when to Mockito.when and then we'd see checkstyle fail.