3 ms·
Maybe I'm missing something obvious but that seemed to be the only option for injecting stub implementations in integration tests.
by nijave 2y ago
Maybe I'm missing something obvious but that seemed to be the only option for injecting stub implementations in integration tests.
- mikeschinkel 2y agoInterfaces are one way to inject stubs, and a good way, but not the only way. You can also use function values as callbacks.
- roncesvalles 2y agoI prefer the testing libraries that do monkey-patching and consider mock implementations of interfaces to be an antipattern in Go, especially if it's the only reason for putting an interface between the calling code and a type.