So what? How is that a problem?
As an example, suppose I have a static method that takes in an object and returns a result based on the state of that object. Now I have conditional logic in the unit under test that has a dependency on the result of that static method. In my unit test, I don't want to go to the trouble of creating the state of the object to force the delegate call to return a certain result that determines the execution flow, I want to just force that call to return the result I need.
> I write functions using ‘static’ all the time. I prefer that a function be static.
This, however, does not mean that all the functions should be static. IMHO, the more static stuff you can extract from your instance methods while keeping parameters count to max 3 (magic number that works for me), the better.
Yes this is the way. [1]
[1] https://en.wikipedia.org/wiki/Hexagonal_architecture_(softwa...
Small nitpick :p
Although due to the ambiguity of the word "function", your nitpick still has its place.
I would really like a way to express pure functions in Java. There would need to some way to mark objects as immutable at the language level.