We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
value thenAnswer is not a member of Nothing
Using Mockito I do not receive the error but when using mockito-scala I do. Code below mirrors the code I'm writing.
scalaVersion: 2.12.16 mockito-scala: 1.17.7
package org.ljr import org.mockito.AdditionalAnswers._ import org.mockito.ArgumentMatchers._ import org.scalatest.matchers.should._ import org.scalatest.wordspec._ import org.mockito.MockitoSugar class AnswerSpecMockito extends AnyWordSpec with Matchers { import Environment._ import org.mockito.Mockito._ val mt = mock(classOf[MockTarget]) when(mt.addTriggers(any[Foo], any[Bar])).thenAnswer(returnsFirstArg()) } class AnswerSpecMockitoScala extends AnyWordSpec with Matchers with MockitoSugar { import Environment._ val mt = mock[MockTarget] /* Compiler error [error] /Users/lripple/ip/mockito-scala-example/src/main/scala/org/ljr /AnswerSpecMockitoScala.scala:23:44: value thenAnswer is not a member of Nothing [error] when(mt.addTriggers(any[Foo], any[Bar])).thenAnswer(returnsFirstArg()) [error] ^ */ when(mt.addTriggers(any[Foo], any[Bar])).thenAnswer(returnsFirstArg()) } object Environment { case class Foo(a: Int, b: String) trait Bar { def key: String } case class BarImpl(key: String, value: String) extends Bar class MockTarget { def addTriggers(foo: Foo, bar: Bar): Foo = foo.copy(b = bar.key) } }
As a workaround I create the mock and set up thenAnswer in a def of an object which does not extends MockitoSugar.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Using Mockito I do not receive the error but when using mockito-scala I do. Code below mirrors the code I'm writing.
scalaVersion: 2.12.16
mockito-scala: 1.17.7
As a workaround I create the mock and set up thenAnswer in a def of an object which does not extends MockitoSugar.
The text was updated successfully, but these errors were encountered: