-
-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to mock wrapped function with value class param #667
Comments
I don't think that the mocking is the problem here, since you're using mockk, it tries to mock all the methods of DummyService, for the purpose of mocking only certain methods (in your case processValue only), you should be using spyk, i.e.:
However, it won't work because of this https://youtrack.jetbrains.com/issue/KT-46477#focus=Comments-27-4952485.0-0 As a temporary workaround until Kotlin 1.5.30-M1 is released, you could make your return type nullable:
Or in case you really want to use mockk, you can make it call the original implementation by doing this:
|
Thanks @d35h actually my issue is more complicated one and I tried to come up with a simple demo that has an issue on it's own as you demonstrated. For now I've changed the test setup to avoid mocking problematic dependencies and I'll try the spyk approach as soon as 1.5.30 is shipped. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are sure that this issue is important and should not be marked as |
Consider following code
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Expected Behavior
DummyValue(42)
printedCurrent Behavior
The text was updated successfully, but these errors were encountered: