org.specs.mock.JMocker.CapturingParam

class CapturingParam

class CapturingParam[T]

 extends TypeSafeMatcher[T] with ScalaObject


Capturing Parameters allow to capture the value of a parameter passed to a mock method.

The most frequent usage for this is to be able to return the parameter as the return value of the method.

Usage:

   val s = capturingParam[String]
   classOf[ToMock].expects(one(_).method(s.capture) willReturn s)
   
It is also possible to use the map function to return a value of a different type:
 
   willReturn s.map(_.size)
   
And the capturing parameter can still be checked for its validity using must(specs matcher):
   classOf[ToMock].expects(one(_).method(s.must(beMatching("h.*")).capture) willReturn s)
   


Source: JMocker.scala(349)

 Constructors

def this

 Fields

capture def capture
capture will add this as a new Matcher to expect
T
captured var captured
stores the captured value, to be able to return it later
T
value def value
the returned value as a ReturnValueAction object
ReturnValueAction

 Methods

!= final def !=(arg0 : Object) Boolean AnyRef
!= final def !=(arg0 : Any) Boolean Any
== final def ==(arg0 : Any) Boolean Any
== final def ==(arg0 : Object) Boolean AnyRef
_dont_implement_Matcher___instead_extend_BaseMatcher_ final def _dont_implement_Matcher___instead_extend_BaseMatcher_ Unit BaseMatcher
asInstanceOf final def asInstanceOf[T0] T0 Any
capture def capture(i : Int)
capture will add this as a new Matcher to expect, with the user-specified index of the parameter
T
clone protected def clone Object AnyRef
describeTo def describeTo(desc : Description)
this describes the result of the optional matchers
Unit
eq final def eq(arg0 : Object) Boolean AnyRef
equals def equals(arg0 : Any) Boolean AnyRef
finalize protected def finalize Unit AnyRef
getClass final def getClass Class[Object] AnyRef
hashCode def hashCode Int AnyRef
isInstanceOf final def isInstanceOf[T0] Boolean Any
map def map[S](f : (T) => S)
adds a function to use when returning the captured value
CapturingParam[T]
matches final def matches(arg0 : Any) Boolean TypeSafeMatcher
matchesSafely def matchesSafely(a : T)
this method stores the parameter value and apply the optional matcher
Boolean
must def must(m : Matcher[T])
adds a matcher to use when checking the parameter
CapturingParam[T]
ne final def ne(arg0 : Object) Boolean AnyRef
notify final def notify Unit AnyRef
notifyAll final def notifyAll Unit AnyRef
synchronized final def synchronized[T0](arg0 : T0) T0 AnyRef
toString def toString String BaseMatcher
wait final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
wait final def wait(arg0 : Long) Unit AnyRef
wait final def wait Unit AnyRef
Copyright (c) 2007-2009. All Rights Reserved.