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

Add support for testing #7

Open
ShaishavGandhi opened this issue Jul 17, 2018 · 0 comments
Open

Add support for testing #7

ShaishavGandhi opened this issue Jul 17, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@ShaishavGandhi
Copy link
Contributor

ShaishavGandhi commented Jul 17, 2018

Extension functions are treated as static functions when you're testing them with Mockito or any other framework. This means that Mockito will fail you when you try to verify method invocations on the wrapper.

Unfortunately, PowerMockito doesn't help either. From the digging I did, the way you do it with PowerMockito is:

mockStatic(CustomWrapper::class.java)
// The following code is the problem. Since extension functions aren't static, this 
// actually won't compile.
`when`(CustomWrapper.getCustomAttribute()).thenReturn()
@ShaishavGandhi ShaishavGandhi added the enhancement New feature or request label Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant