eq and any failing with data classes
See original GitHub issueLooks like regardless of what data class eq and any has to instantiate, it always fails
java.lang.ClassCastException: org.mockito.Answers cannot be cast to org.mockito.stubbing.Answer
at com.nhaarman.mockito_kotlin.CreateInstanceKt.uncheckedMock(CreateInstance.kt:162)
at com.nhaarman.mockito_kotlin.CreateInstanceKt.createNullableInstance(CreateInstance.kt:151)
at com.nhaarman.mockito_kotlin.CreateInstanceKt.newInstance(CreateInstance.kt:139)
at com.nhaarman.mockito_kotlin.CreateInstanceKt.createInstance(CreateInstance.kt:60)
Reproduces always with version 0.4.0
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
eq and any failing with data classes · Issue #35 - GitHub
Looks like regardless of what data class eq and any has to instantiate, it always fails java.lang.ClassCastException: org.mockito.
Read more >What's the difference between Mockito Matchers isA, any, eq ...
any() checks absolutely nothing. Since Mockito 2.0, any(T.class) shares isA semantics to mean "any T " or properly "any instance of type T...
Read more >Eq - Λrrow Core
The Eq typeclass abstracts the ability to compare two instances of any object. It can be considered the typeclass equivalent of Java's Object#equals...
Read more >This doesn't work - but I think it should, or I'm doing it wrong.
I tried several different things, all failed: ServiceResource aResource = new ServiceResource(); aResource.setID(5); aResource.setData(anyString()); Not enough ...
Read more >Mockito Argument Matchers - any(), eq() - DigitalOcean
If we want to use a specific value for an argument, then we can use eq() method. when(mockFoo.bool(eq("false"), anyInt(), any(Object.class))).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let’s reopen this issue for further investigation.
It looks like this issue and #39 are caused by using Mockito 1.x. This library really focuses on the soon-to-be-released 2.x version.