-
-
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
Mocking unsigned Kotlin types ends in java.lang.ClassCastException
#544
Comments
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 |
Looks like something not related to mockk itself as mockk calls byte-buddy under the hood and then byte-buddy delegates getting declaration of methods to Class from jdk: ByteBuddy::MethodList::type::getDeclaredMethods, which returns int instead of UInt. I'd say that Kotlin's UInt is not interpolated correctly by this method making UInt as Int |
I ran into what may be the same issue trying to verify behavior on a mock with a method that takes a
The error refers to trying to match a signature with
|
Unsigned integer support in Kotlin is still in beta, so I guess @d35h is right. |
I guess #633 might resolve this, since unsigned types are implemented using value classes |
Does not look like #633 solved this issue. Any idea the scope of work to get this to work? |
Same issue here trying to mock a
As result, I have the next: |
I do have the same issue even with version |
I can confirm the same issue is present even with version |
Problem still here. mockk |
This issue still seems to be present on |
I'm mocking simple function returning
UInt
but after that method is executed in the test it crashes withjava.lang.ClassCastException
.Expected Behavior
No crash, mocked function returns unsigned number result.
Current Behavior
Exception
java.lang.ClassCastException: kotlin.UInt cannot be cast to java.lang.Integer
is thrown in case of UInt return type.Steps to Reproduce
every
function for a method returning unsigned number like UIntContext
Minimal reproducible code (the gist of this issue)
The text was updated successfully, but these errors were encountered: