Override dependency in tests #12
Unanswered
nicky-isaacs
asked this question in
Q&A
Replies: 1 comment
-
The simplest way would be to mark your mock component as primary, so it will override the real one. I'll admit, overriding might be something to improve. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I am evaluating Springtime as a longtime Guice fan looking for a Rust alternative. So far it looks great! The one thing I couldn't quite work out is how to override parts of the dependency graph in tests. Assume I have the following hypothetical dependencies
FriendService => UserService => SqlClient
, in my test I would like to provide a mock implementation forSqlClient
and build an instance ofFriendService
and invoke it in my tests. How can I accomplish this in Springtime? I have been fumbling around with the methods inTypedComponentDefinitionRegistry
(register_component_typed
sounds relevant but alas I have not been able to crack this)Beta Was this translation helpful? Give feedback.
All reactions