Breaking dependencies in unit tests

"Would I use classloader magic and bytecode manipulation to set dependencies in production code? No. Would I use reflection to modify private fields in production code? No. Would I refactor to introduce an interface between objects? Yes. Would I refactor an object to get a dependency through its constructor instead of from a global variable? Yes." Nat Pryce

Comments

Popular posts from this blog

Haskell: performance

Regular expressions: Rust vs F# vs Scala

Hash maps: Rust, F#, D, Go, Scala