3 ms·
My problem is that 100% of the time, the chain of construction is as brittle as if you'd not used DI as all. It's not that clear with Foo(SomeType). What I us
by mrkeen 4y ago
My problem is that 100% of the time, the chain of construction is as brittle as if you'd not used DI as all.
It's not that clear with Foo(SomeType). What I usually deal with is:
AuthController(AuthService(UserService(UserRepo(Hikari(Postgres(..))))).
Now I just want to test that AuthService accepts/rejects a user based on whether they're in the system or not. I want to do something like:
users = new Map<UserId, User>()
auth = new AuthService(users::get)
> And when there's multiple instances of a given type...
(There should always be (in the case that you're writing a test for something))
> a good framework refuses to guess
I do too! I want to manually wire the classes inside main() in the usual case, and manually wire (different combinations) of classes in the tests.