How to stub non-deterministic dependencies