Skip to content

Instantly share code, notes, and snippets.

@ripa1993
Created July 5, 2018 12:20
Show Gist options
  • Save ripa1993/e48fa1746ab147c3b01389dcdb4abc95 to your computer and use it in GitHub Desktop.
Save ripa1993/e48fa1746ab147c3b01389dcdb4abc95 to your computer and use it in GitHub Desktop.
Mockito: mock a method that has implicit function parameter
class Foo {
def get(a: A)(implicit b: B, c: C => String): String
}
class FooSpec {
val mockFoo = mock[Foo]
val a: A = A()
when(mockFoo.get(eq(a))(any[B], any[(C) => String].apply).thenReturn("Hi")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment