5
Ho un test molto semplice e sto cercando di simulare un tratto. Il test non viene nemmeno eseguito e fallisce con l'errore di inizializzazione: java.lang.IllegalArgumentException: requisito non riuscito: ti sei ricordato di utilizzare conExpectations?Come si usano i joystick proxy ScalaMock?
Ecco il mio test molto semplice:
import org.scalatest._
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.matchers.ShouldMatchers
import org.scalamock.ProxyMockFactory
import org.scalamock.scalatest.MockFactory
@RunWith(classOf[JUnitRunner])
class TurtleSpec extends FunSpec with MockFactory with ProxyMockFactory {
trait Turtle {
def turn(angle: Double)
}
val m = mock[Turtle]
m expects 'turn withArgs (10.0)
describe("A turtle-tester") {
it("should test the turtle") {
m.turn(10.0)
}
}
}