Say, my class Person
collaborates with other classes, Kettle
and Teacup
.
Person
has a method makeTea()
that should interact with Kettle
and Teacup
, each in different ways, in succession, but the order is unimportant.I would like to capture interactions between the Person
and Kettle
, and the interactions between Person
and Teacup
individually in two separate unit tests (let's call them testPersonFillsKettleWithWater
and testPersonPoursBoilingWaterIntoTeacup
)
To test the method makeTea()
it is not necessary to have Kettle
nor Teacup
. When testing for interactions with Kettle
, any interactions Teacup
don't matter.
With ScalaMock however if you do not declare expectations on Teacup
and yet some interactions occur, then Teacup
throws tantrums about "Unexpected method calls" etc.
In jMockit literature this is called setting 'strict' expectations. I would like to be able to omit specifying every expectation, and just test for certain interactions within one method. So the question is:
Does ScalaMock support non-strict expectations?
I'm aware of the mock stub 'method
syntax, but it is cumbersome to list out all the expectations that I find myself having to list.