Skip to content

Instantly share code, notes, and snippets.

@spiffxp
Created January 22, 2013 08:45
Show Gist options
  • Save spiffxp/4593110 to your computer and use it in GitHub Desktop.
Save spiffxp/4593110 to your computer and use it in GitHub Desktop.
Troubles w/ ScalaTest suite-scoped mocks in ScalaMock 3.x when using proxy mocks
package com.example
import org.scalatest.FunSuite
import org.scalamock.scalatest.MockFactory
import org.scalamock.proxy.ProxyMockFactory
class SuiteScopedMockTest extends FunSuite with MockFactory with ProxyMockFactory {
trait Foo {
def foo (i: Int)
}
val foo = super[ProxyMockFactory].mock[Foo]
test("suite-scoped Foo expects 1") {
foo.expects('foo)(1)
foo.foo(1)
}
test("the call with 2 should not be unexpected") {
foo.expects('foo)(2)
foo.foo(2)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment