मेरे पास एक बहुत ही सरल परीक्षण है और मैं एक विशेषता का नकल करने की कोशिश कर रहा हूं। परीक्षण भी नहीं चलता है, और यह प्रारंभिक त्रुटि के साथ विफल रहता है: java.lang.IllegalArgumentException: आवश्यकता विफल: क्या आपको एक्सपेक्शंस के साथ उपयोग करने के लिए याद किया गया है?मैं स्कैलामोक प्रॉक्सी मैक्स का उपयोग कैसे करूं?
यहाँ मेरी बहुत ही साधारण परीक्षण है:
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)
}
}
}