mockito / mockito-kotlin

Using Mockito with Kotlin
MIT License
3.11k stars 202 forks source link

Replace OngoingStubbing<T>.doReturn(List<T>) with doReturnConsecutively. #279

Closed nhaarman closed 6 years ago

nhaarman commented 6 years ago

This fixes an conflicting overloads issue in the following case:

mock<() -> List<String>> {
  on { invoke(any()) }.doReturn(emptyList())
}

Here on returns an OngoingStubbing<List<String>>, and calling doReturn(List<T>) can't choose between the single element parameter and the multi-item parameter.

This is a breaking change, but can be simply fixed by the tools in IDEA.

See #274, will be fixed when OngoingStubbing<T>.doReturn(List<T>) is removed.