I have an enum class that I'm trying to mock using...
# android
s
I have an enum class that I'm trying to mock using mockito. All I'm doing is
val category = mock(Category::class.java)
where Category is the enum. And when I run the test I'm seeing a
NoClassDefFoundError
I already added the mock-maker-inline file but any thoughts on what I'm doing wrong here?
d
Maybe additionally try to add mockito dependency with inline applied: https://mvnrepository.com/artifact/org.mockito/mockito-inline To be 100% sure that inline is applied, because this error still sound to me like "final class" issue.
s
Hmm, didn't do it for me, thanks for your reply though
t
What version of mockito are you using, and could you post the complete stacktrace?
You’ll want to use 2.+ for the inline mockmaker. This project supplies some nice syntactic sugar for Kotlin: https://github.com/mockito/mockito-kotlin You might also want to look into MockK: https://mockk.io/
533 Views