Skip to content
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

Allow mocking of native methods #162

Open
the-felipeal opened this issue Apr 30, 2020 · 1 comment
Open

Allow mocking of native methods #162

the-felipeal opened this issue Apr 30, 2020 · 1 comment

Comments

@the-felipeal
Copy link

For example, Binder.getCallindUid()

@kkoser
Copy link
Contributor

kkoser commented May 18, 2020

This seems possible, I can think of a few ways to do it - 1) you can override native methods from parent classes with non-parent subclasses, and 2) You could code generate a native library and load that, and have it provide a faked implementation.

Where it gets more difficult is with the binder example you mentioned - Note that you can't mock final or static methods before Android P (where the mockito-inline support was added). I'm not sure the JVMTI implementation would play with native methods, that still needs more investigation.

I don't know when we'll have time to work on this however. I'll take this to my team and see if anyone can work on it, but also if anyone is interested in trying it out we're open to PRs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants