There are two styles of using ScalaMock; I will show you a solution showing the recording style based on Mockito Record-Then-Verify. Say you had a trait Fooas follows:
trait Foo{
def bar(s:String):String
}
And then a class that uses an instance of this trait:
class FooController(foo:Foo){
def doFoo(s:String, b:Boolean) = {
if (b) foo.bar(s)
}
}
If I wanted to check that if a false value is given for a parameter b, foo.barit is not called, I could set it like this:
val foo = stub[Foo]
val controller = new FooController(foo)
controller.doFoo("hello", false)
(foo.bar _).verify(*).never
*, , bar String. , , :
(foo.bar _).verify("hello").never