How can I mock dependend traits with mockito? I have two traits:
trait A {
def a = 1
}
trait B extends A {
def b = {
// do things
a
// do things
}
}
Now, I want to test Trait B. And I want to verify, that A.a() gets called:
class SmallTest extends FunSuite with MockitoSugar {
test("prove, that a gets called") {
val mockA = mock[A]
val b = new B with mockA {} // This won't compile
b.b
verify(mockA).a
}
}
This example won't compile. But how would I "inject" my mock otherwise?