| OVERVIEW | PACKAGE | CONSTR | FIELDS | METHODS | FRAMES NO FRAMES | INHERITED |
object JMocker
extends
JMocker
def this
|
| addExpectation |
def addExpectation
|
Null | |
| anyBoolean |
def anyBoolean
shortcut for expectations
[details]
`with`(new IsAnything[Boolean])
|
Boolean | JMocker |
| anyByte |
def anyByte
shortcut for expectations
[details]
`with`(new IsAnything[Byte])
|
Byte | JMocker |
| anyChar |
def anyChar
shortcut for expectations
[details]
`with`(new IsAnything[Char])
|
Char | JMocker |
| anyDouble |
def anyDouble
shortcut for expectations
[details]
`with`(new IsAnything[Double])
|
Double | JMocker |
| anyFloat |
def anyFloat
shortcut for expectations
[details]
`with`(new IsAnything[Float])
|
Float | JMocker |
| anyInt |
def anyInt
shortcut for expectations
[details]
`with`(new IsAnything[Int])
|
Int | JMocker |
| anyLong |
def anyLong
shortcut for expectations
[details]
`with`(new IsAnything[Long])
|
Long | JMocker |
| anyShort |
def anyShort
shortcut for expectations
[details]
`with`(new IsAnything[Short])
|
Short | JMocker |
| anyString |
def anyString
shortcut for expectations
[details]
`with`(new IsAnything[String])
|
String | JMocker |
| context |
var context
the context holds the mocks, the expectations so is able to get the calls and check them
|
Mockery | JMockerContext |
| createMockery |
def createMockery
|
Mockery | Imposterizer |
| example |
protected[this] var example
|
Option[Example] | ExampleLifeCycle |
| expectations |
var expectations
call expectations with optional constraints on the number of calls, on parameters, return values,
[details]
..
|
Expectations | JMockerContext |
| isSequential |
def isSequential
|
Boolean | ExampleLifeCycle |
| newMockery |
def newMockery
|
Mockery | Imposterizer |
| sequential |
protected var sequential
|
Boolean | ExampleLifeCycle |
| until |
def until
|
Boolean | ExampleLifeCycle |
| != |
final def !=(arg0 : Object)
|
Boolean | AnyRef |
| != |
final def !=(arg0 : Any)
|
Boolean | Any |
| == |
final def ==(arg0 : Any)
|
Boolean | Any |
| == |
final def ==(arg0 : Object)
|
Boolean | AnyRef |
| RangeToCallConstraint |
implicit def RangeToCallConstraint(r : Range)
Adds call constraint method to a range, to express the between constraint
|
RangeCallConstraint | JMocker |
| a |
def a[T]
always match the parameter
|
T | JMocker |
| a |
def a[T](implicit m : Manifest[T])
shortcut for expectations
[details]
`with`(new IsInstanceOf[T])
|
T | JMocker |
| aNonNull |
def aNonNull[T](implicit m : Manifest[T])
shortcut for expectations
[details]
`with`(new IsNot(IsNull[T]))
|
T | JMocker |
| aNull |
def aNull[T](implicit m : Manifest[T])
shortcut for expectations
[details]
`with`(new IsNull[T])
|
T | JMocker |
| after |
implicit def after(v : => Any)
this class allows an expectation to declare that another expectation should follow
|
InSequenceThen | JMocker |
| afterCall |
implicit def afterCall(v : Any)
allows any block of expectations to be followed by state actions and expectations
|
StateConstraint | JMocker |
| afterExample |
def afterExample(ex : Example)
|
Unit | ExampleLifeCycle |
| afterTest |
override def afterTest(ex : Example)
After a test the context is verified
[details]
If some more expectations are not met an ExpectationError is thrown
In that case, it is transformed to a failure exception
|
Unit | JMockerExampleLifeCycle |
| allowing |
def allowing[T](mockObjectMatcher : Matcher[T])
allowing any calls to mocks
|
MethodClause | JMocker |
| allowing |
def allowing[T](mockObject : T)
allowing any calls to the mock
|
T | JMocker |
| allowingMatch |
def allowingMatch(methodName : String)
allowing any calls to any mock with method names like the passed parameter, returning default values
|
ParametersClause | JMocker |
| allowingMatch |
def allowingMatch[T](mock : T, methodName : String)
allowing any calls to a mock with method names like the passed parameter, returning default values
|
ParametersClause | JMocker |
| an |
def an[T]
always match the parameter
|
T | JMocker |
| an |
def an[T](implicit m : Manifest[T])
shortcut for expectations
[details]
`with`(new IsInstanceOf[T])
|
T | JMocker |
| any |
def any[T](implicit m : Manifest[T])
shortcut for expectations
[details]
`with`(new IsAnything[T])
|
T | JMocker |
| anyToExpectationCounter |
implicit def anyToExpectationCounter[T](a : => T)
Adds an isExpectation method to any block of code (mock expectation, scalacheck property) to better count the number of expectations
|
ExpectationCounter[T] | ExpectationsListener |
| anything |
def anything[T]
shortcut for new IsAnything[T]
|
IsAnything[T] | HamcrestMatchers |
| as |
def as[T](name : String)(expects : (T) => Any)(implicit m : Manifest[T])
mocks a class and add expectations, specifying the mock with a name
[details]
|
(T, (T) => Any) | JMocker |
| as |
def as[T](expects : (T) => Any)(implicit m : Manifest[T])
mocks a class and add expectations
[details]
Usage
willReturn(as[MyInterface]{m: MyInterface => one(m).method }) |
(T, (T) => Any) | JMocker |
| as |
def as[T](expects : (T) => Any*)(implicit m : Manifest[T])
mocks a class several times and add expectations for each mock
[details]
Usage
willReturn(as[MyInterface]),
{m1: MyInterface => one(m1).method },
{m2: MyInterface => one(m2).method },
) |
List[(T, (T) => Any)] | JMocker |
| asInstanceOf |
final def asInstanceOf[T0]
|
T0 | Any |
| atLeast |
def atLeast(count : Int)
expecting atLeast count calls to the mock
|
ReceiverClause | JMocker |
| atMost |
def atMost(count : Int)
expecting at Most calls to the mock
|
ReceiverClause | JMocker |
| beforeExample |
override def beforeExample(ex : Example)
before any example, a new context and new expectations should be created
|
Unit | JMockerExampleLifeCycle |
| beforeTest |
def beforeTest(ex : Example)
|
Unit | ExampleLifeCycle |
| between |
def between(minCount : Int, maxCount : Int)
expecting between minCount and maxCount (inclusive) calls to the mock
|
ReceiverClause | JMocker |
| capturingParam |
def capturingParam[T]
factory method to create a new capturing parameter
|
CapturingParam[T] | JMocker |
| checkContext |
def checkContext
This method can be used to check the context
[details]
It will always restart the context, even if there is an ExpectationError
In that case, it is transformed to a failure exception
|
Unit | JMockerContext |
| classToMock |
implicit def classToMock[T](c : Class[T])
Extends Class objects with the one-liner
expects
Usage:
classOf[List[Int]]
[details]
|
ClassToMock[T] | JMocker |
| clone |
protected def clone
|
Object | AnyRef |
| doAll |
def doAll(actions : Action*)
action executing several other actions
|
DoAllAction | JMockActions |
| eq |
final def eq(arg0 : Object)
|
Boolean | AnyRef |
| equal |
def equal[T](value : T)
shortcut for expectations
[details]
`with`(new IsEqual[T](value))
|
T | JMocker |
| equals |
def equals(arg0 : Any)
|
Boolean | AnyRef |
| exactly |
def exactly(count : Int)
expecting exactly count calls to the mock
|
ReceiverClause | JMocker |
| executeTest |
override def executeTest(ex : Example, t : => Any)
An expectation error may be thrown during the execution of a test
In that case, it is transformed to a failure exception
|
Any | JMockerExampleLifeCycle |
| expect |
def expect[T](f : (T) => Any)(implicit m : Manifest[T])
One liner function for expectations
[details]
Usage: |
ExpectBlock[T] | JMocker |
| expect |
def expect(block : => Any)
the code block being evaluated should contain some expectations being added to the expectations variable
Then the expectations are "freezed" by calling the checking method on context and the actual system behaviour can
be exercised
|
Any | JMocker |
| finalize |
protected def finalize
|
Unit | AnyRef |
| getClass |
final def getClass
|
Class[Object] | AnyRef |
| hashCode |
def hashCode
|
Int | AnyRef |
| ignoring |
def ignoring[T](mockObject : T)
ignoring any calls to the mock, returning default values
|
T | JMocker |
| ignoring |
def ignoring[T](mockObjectMatcher : Matcher[T])
ignoring any calls to the mock, returning default values
|
MethodClause | JMocker |
| ignoringMatch |
def ignoringMatch(methodName : String)
ignoring any calls to the mock with method names like the passed parameter, returning default values
|
ParametersClause | JMocker |
| ignoringMatch |
def ignoringMatch[T](mock : T, methodName : String)
ignoring any calls to a mock with method names like the passed parameter, returning default values
|
ParametersClause | JMocker |
| inSequence |
def inSequence(sequence : Sequence)
adds a constraint to the expectations to declare that an expected call must happen in sequence
|
Unit | JMocker |
| intToCallConstraint |
implicit def intToCallConstraint(i : Int)
Adds call constraint method to integers to express the exactly, atLeast, atMost
|
IntCallConstraint | JMocker |
| isExpectation |
def isExpectation[T](a : => T)
Declares a block of code to count as an expectation
|
T | ExpectationsListener |
| isInstanceOf |
final def isInstanceOf[T0]
|
Boolean | Any |
| mock |
def mock[T](implicit m : Manifest[T])
the mock method is used to create a mock object
Usage:
val mocked = mock[InterfaceToMock] Classes can be mocked too, but the ClassImposterizer trait has to be added to the extensions [details]
|
T | JMocker |
| mockAs |
def mockAs[T](name : String)(implicit m : Manifest[T])
mocks a class and give the resulting mock a name
[details]
jMock expects mocks of the same class to have different names
|
T | JMocker |
| ne |
final def ne(arg0 : Object)
|
Boolean | AnyRef |
| never |
def never[T](mockObject : T)
forbidding any calls to the mock
|
T | JMocker |
| notify |
final def notify
|
Unit | AnyRef |
| notifyAll |
final def notifyAll
|
Unit | AnyRef |
| onConsecutiveCalls |
def onConsecutiveCalls(actions : Action*)
[details]
|
ActionSequence | JMockActions |
| one |
def one[T](m : T)
expecting exactly one call to the mock
|
T | JMocker |
| restart |
def restart
creates a new context and a new Expectations object
|
Unit | JMockerContext |
| returnValue |
def returnValue[T](result : T)
action returning a value
|
ReturnValueAction | JMockActions |
| same |
def same[T](value : T)
shortcut for expectations
[details]
`with`(new IsSame[T](value))
|
T | JMocker |
| setSequential |
def setSequential
|
Unit | ExampleLifeCycle |
| state |
def state(name : String)
[details]
|
States | JMocker |
| synchronized |
final def synchronized[T0](arg0 : T0)
|
T0 | AnyRef |
| then |
def then(state : State)
specifies that after a call, a State object will be in a specific state
|
Unit | JMocker |
| throwEx |
def throwEx[T <: Throwable](t : T)
action throwing an exception of type T
|
ThrowAction | JMockActions |
| toAction |
implicit def toAction[T](v : T)
allow the return value of the method to be more precisely specified with a JMock action, like a returnValue action
|
JMockAction[T] | JMocker |
| toString |
def toString
|
String | AnyRef |
| wait |
final def wait(arg0 : Long, arg1 : Int)
|
Unit | AnyRef |
| wait |
final def wait
|
Unit | AnyRef |
| wait |
final def wait(arg0 : Long)
|
Unit | AnyRef |
| when |
def when(predicate : StatePredicate)
specifies that a call can only occur following the specific condition on a state
|
Unit | JMocker |
| will |
def will[T](m : Matcher[T])
this method is used to avoid the use of the reserved Scala keyword 'with'
[details]
This is also consistent with the way to specify returned values
|
T | JMocker |
| will |
def will(action : Action)
set up a jMock action to be executed
|
Unit | JMocker |
| will |
implicit def will[T](m : Matcher[T])
[details]
|
T | JMocker |
| with |
def with[T](matcher : Matcher[T])
constraining the latest call expectation with a Hamcrest matcher
|
T | JMocker |
| withName |
def withName(nameRegex : String)
[details]
|
MethodNameMatcher | HamcrestMatchers |
| OVERVIEW | PACKAGE | CONSTR | FIELDS | METHODS | FRAMES NO FRAMES | INHERITED |