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
kotlin.Result<T> mocking is not working as expected #645
Comments
This is known problem, it should be solved by this #633 |
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 |
I've seen the new version 1.12.0 of Mockk and I gave it a try. For some reason the
Have you tried my use case with the new version 1.12.0? |
It is reproduced in 1.12.0 (kotlin 1.5.21 ~ 1.5.31) |
This is still occurring in 1.12.0 |
I can confirm it still happens for |
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 |
Any news on this? Could you put the important label? |
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 |
The issue is still present with: kotlin The Any news on this issue? Could you put the |
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 |
Any news on this? Could you put the |
It's still happening in 1.13.8 and Kotlin 1.9 |
Same issue. |
Prerequisites
Please answer the following questions for yourself before submitting an issue.
1.10.6
and1.11.0
)Expected Behavior
I expect that mockk treats
kotlin.Result<T>
class as other classesCurrent Behavior
It seems that it is unnecessary wrapping any
Result<T>
return type to anotherResult.success
instance making even a basic test fail.Failure Information (for bugs)
I have no useful information at this time... I'll add if I find useful info.
Steps to Reproduce
Let's consider this piece of code:
Now I'm gonna test, with a mockk of
MyInterface
, that it returns the instance ofData
class wrapped in aResult.success
instance:This test fails with:
But there's no code wrapping the
Data()
in two successes... from where does it come?The thing is that it's a problem of the
Result
class because if you do this, the test passes:Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Minimal reproducible code (the gist of this issue)
The text was updated successfully, but these errors were encountered: