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
Mocking methods with inline class return type #249
Comments
Same problem occurs for me with |
Inline classes are not supported |
Is there another issue tracking and what needs to happen to support |
Check #152. There is kind of workaround. Don't know if it works |
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 |
Don't reopen in favour of #152 |
@oleksiyp, this seems to still have not been solved in 1.10.0. Also, #152 is about receiving a parameter of an inline class type, whereas this issue is about a return value of an inline class type, so maybe this issue should be reopened? (Note in particular that the workaround mentioned in #152 - namely not passing |
Hey, @oleksiyp, any news about this issue? Anything we can do to help? |
3 years in the making... Unfortunately, mockk's own code is very complex, not easy to contribute... |
The issue
Seems that here are some issues with inline classes returning using
returns
infix function, but I am not sure if it's actually an issue inside Mockk.When I'm trying to return a response wrapped with inline class type ClassCastException happens.
After
inline
modifier removal on class definition all works fine.Here is the code:
Test method part:
every { refToObjectThatHasInlineClassReturnType.method(any()) } returns ResponseCode(0)
Invoked method's part that actually returns a wrapped type:
fun method(): ResponseCode { return ResponseCode(/*value*/) }
The inline class itself:
inline class ResponseCode(private val value: Int) { val isSuccessful: Boolean get() = value == SOME_CONSTANT }
Steps to Reproduce
Context
Stack trace
Dependency definition
whereas
mockk_version
property has a value of1.9.kotlin12
The text was updated successfully, but these errors were encountered: