July 18, 2023 Simple Design, Mock Objects, Refactoring
In his “The Hidden Cost of Mockito”, Lars Eckart presents an example in Java of refactoring code in a way that simplifies using Mockito in the corresponding unit tests. His example illustrates very nicely one of two helpful options for refactoring in this situation; I wanted to write this article to describe the other. I imagine that we could find even more helpful refactoring options than these two, but two options seem to me like a helpful place to start.
This is a companion discussion topic for the original entry at https://blog.thecodewhisperer.com/permalink/from-stubs-to-parsers