4 ms·
globalvar = new NopImpl() works fine for testing. If you squint, you can even think of dependency injection frameworks like Dagger as a lot of boilerplate arou
by ori_b 5y ago
globalvar = new NopImpl()
works fine for testing. If you squint, you can even think of dependency injection frameworks like Dagger as a lot of boilerplate around a global database of instantiations.
- deleted 5y ago[deleted]
- dcow 5y agoUntil you try to run two tests at once, one which requires NopImpl and one which requires the real impl.
- sagichmal 5y agoAs dcow pointed out, it really doesn't work fine for testing, as it couples what should be isolated tests together, and prevents them from being executed concurrently.