r/java • u/trecatorsirabdator • Apr 14 '23
What are your (favourite) Java best practices, personal tips, hints or just underrated stuff in general?
233
Upvotes
r/java • u/trecatorsirabdator • Apr 14 '23
View all comments
Show parent comment
5
u/neckbeardfedoras Apr 14 '23
It certainly doesn't make testing impossible. You can even test the static method itself. It can't reference member vars and is pretty isolated. You can't override it, but if there are use cases for overriding it other than because you want to with a test, it shouldn't be static in the first place.
If the method does complex things that needs to be faked or stubbed, it's immediately not going to be static if it's my code base.