CommandRuntimeException: Could not resolve type SomeCommand #1293
-
Hi. I'm coding a command that plays with git and local files. It works well. Then I wanted to add unit tests. I chose to create an interface to represent git and filesystem actions so that I can mock them. I added constructor to my command:
And now this exception occurs:
Is there a way to annotate the injection constructor? Or to configure instantiation with a lambda? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I found a workaround but I would like a proper answer. The workaround is to use a static method and a private constructor.
|
Beta Was this translation helpful? Give feedback.
-
Multiple public constructors aren't supported. You'd either want to set up proper DI for the app, a single constructor that has defaults or maybe mark the one for testing as internal. |
Beta Was this translation helpful? Give feedback.
Multiple public constructors aren't supported. You'd either want to set up proper DI for the app, a single constructor that has defaults or maybe mark the one for testing as internal.