You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fun interfaceFunInterfaceToTest : (String) -> Int
val myInterfaceToTest:FunInterfaceToTest= spy(
FunInterfaceToTest { mock() }
)
If new IR kotlin compiler backend is enabled then
launching test with SAM throws this:
org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: class my.company.package.test$sam$my_company_package_FunInterfaceToTest$0.
Can not mock final classes with the following settings :
- explicit serialization (e.g. withSettings().serializable())
- extra interfaces (e.g. withSettings().extraInterfaces(...))
You are seeing this disclaimer because Mockito is configured to create inlined mocks.
You can learn about inline mocks and their limitations under item #39 of the Mockito class javadoc.
OR
if use anonymous object than i got this:
org.mockito.exceptions.base.MockitoException:
Cannot mock/spy class java.lang.Integer
Mockito cannot mock/spy because :
- Cannot mock wrapper types, String.class or Class.class
in some cases I got this:
Argument passed to verify() is of type and is not a mock!
Make sure you place the parenthesis correctly!
See the examples of correct verifications:
verify(mock).someMethod();
verify(mock, times(10)).someMethod();
verify(mock, atLeastOnce()).someMethod();
org.mockito.exceptions.misusing.NotAMockException:
BUT
If in build.gradle file I enable old kotlin compiler backend than
For ex. my code looks like this:
If new IR kotlin compiler backend is enabled then
launching test with SAM throws this:
OR
if use anonymous object than i got this:
in some cases I got this:
BUT
If in build.gradle file I enable old kotlin compiler backend than
everything works fine, but why??
Full Test Suite
The text was updated successfully, but these errors were encountered: