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

java.lang.AbstractMethodError When trying to capture lambdas #1074

Open
marcpetitvecino opened this issue Apr 4, 2023 · 0 comments
Open

Comments

@marcpetitvecino
Copy link

Expected Behavior

Test passes with no errors

Current Behavior

Given the following code
val onSuccess = slot<(List<AEQuery>) -> Unit>() val onFailure = slot<(Failure) -> Unit>() val expectedResult: Either<Failure, List<AEQuery>> = expectedQueries.right() coEvery { getAEQueries(GetAEQueries.Params.forAEQueryRequest(queryRequest)).fold(capture(onFailure), capture(onSuccess)) } coAnswers { onSuccess.captured.invoke(expectedQueries) }

The coEvery function throws this error:
Receiver class kotlin.jvm.functions.Function1$Subclass0 does not define or inherit an implementation of the resolved method 'abstract java.lang.Object invoke(java.lang.Object)' of interface kotlin.jvm.functions.Function1. java.lang.AbstractMethodError: Receiver class kotlin.jvm.functions.Function1$Subclass0 does not define or inherit an implementation of the resolved method 'abstract java.lang.Object invoke(java.lang.Object)' of interface kotlin.jvm.functions.Function1.

  • MockK version: 1.13.4
  • OS: macOS Monterrey 12.6.3
  • Kotlin version: 1.8.10
  • JDK version: 11.0.15
  • JUnit version: 4.13.1
  • Type of test: Unit test

I've seen some similar issues related to Proguard or R8 but it seems it's not the case for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant