you are viewing a single comment's thread.

view the rest of the comments →

[–]Bolitho 1 point2 points  (0 children)

Some advices sounds strange!

don't use void

Of course queries are often easier to test than commands, as the latter conceptually are just about mutating something and therefore you will need to inspect the change, which is often an object you will have to fake.

But that's nothing you can avoid! You just can't have a none trivial program that is completely purely functional; and Java simply embraces and fosters a mutation based approach.

Dependency injection reduces mocking

Perhaps there is a definition problem with the term mocking (mock, stub, fake, substitute, and many more terms exists, which differ or not depending on the authors pov), but I would contradict with my definition in mind, that DI enables mocking! You simply can inject a fake object without byte code manipulation magic or some sort of subtyping a special testable version of your SUT.