org.scalatest.mock

class JMockExpectations

[source: org/scalatest/mock/JMockExpectations.scala]

final class JMockExpectations
extends org.jmock.Expectations with AnyRef
Subclass of org.jmock.Expectations that provides withArg alternatives to the with methods defined in its superclass.

JMockCycle's expecting method of passes an instance of this class to the function passed into expectations. Because JMockExpectations extends org.jmock.Expectations, all of the Expectations methods are available to be invoked on instances of this class, in addition to several overloaded withArg methods defined in this class. These withArg methods simply invoke corresponding with methods on this. Because with is a keyword in Scala, to invoke these directly you must surround them in back ticks, like this:

 oneOf (mockCollaborator).documentAdded(`with`("Document"))
 

By importing the members of the JMockExpectations object passed to a JMockCycle's executing method, you can instead call withArg with no back ticks needed:

 oneOf (mockCollaborator).documentAdded(withArg("Document"))
 
Author
Bill Venners
Method Summary
def withArg (value : Float) : Float
Invokes with on this instance, passing in the passed value.
def withArg (matcher : org.hamcrest.Matcher[Float]) : Float
Invokes with on this instance, passing in the passed matcher.
def withArg (value : Double) : Double
Invokes with on this instance, passing in the passed value.
def withArg (matcher : org.hamcrest.Matcher[Boolean]) : Boolean
Invokes with on this instance, passing in the passed matcher.
def withArg (value : Boolean) : Boolean
Invokes with on this instance, passing in the passed value.
def withArg (matcher : org.hamcrest.Matcher[Long]) : Long
Invokes with on this instance, passing in the passed matcher.
def withArg (value : Char) : Char
Invokes with on this instance, passing in the passed value.
def withArg (matcher : org.hamcrest.Matcher[Byte]) : Byte
Invokes with on this instance, passing in the passed matcher.
def withArg (value : Long) : Long
Invokes with on this instance, passing in the passed value.
def withArg [T](value : T) : T
Invokes with on this instance, passing in the passed value.
def withArg [T](matcher : org.hamcrest.Matcher[T]) : T
Invokes with on this instance, passing in the passed matcher.
def withArg (value : Short) : Short
Invokes with on this instance, passing in the passed value.
def withArg (value : Int) : Int
Invokes with on this instance, passing in the passed value.
def withArg (matcher : org.hamcrest.Matcher[Int]) : Int
Invokes with on this instance, passing in the passed matcher.
def withArg (matcher : org.hamcrest.Matcher[Char]) : Char
Invokes with on this instance, passing in the passed matcher.
def withArg (matcher : org.hamcrest.Matcher[Double]) : Double
Invokes with on this instance, passing in the passed matcher.
def withArg (matcher : org.hamcrest.Matcher[Short]) : Short
Invokes with on this instance, passing in the passed matcher.
def withArg (value : Byte) : Byte
Invokes with on this instance, passing in the passed value.
Methods inherited from org.jmock.Expectations
org.jmock.Expectations.buildExpectations, org.jmock.Expectations.currentBuilder, org.jmock.Expectations.exactly, org.jmock.Expectations.oneOf, org.jmock.Expectations.one, org.jmock.Expectations.atLeast, org.jmock.Expectations.between, org.jmock.Expectations.atMost, org.jmock.Expectations.allowing, org.jmock.Expectations.allowing, org.jmock.Expectations.ignoring, org.jmock.Expectations.ignoring, org.jmock.Expectations.never, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.with, org.jmock.Expectations.will, org.jmock.Expectations.when, org.jmock.Expectations.then, org.jmock.Expectations.inSequence, org.jmock.Expectations.inSequences
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
def withArg[T](value : T) : T
Invokes with on this instance, passing in the passed value.

def withArg(value : Int) : Int
Invokes with on this instance, passing in the passed value.

def withArg(value : Short) : Short
Invokes with on this instance, passing in the passed value.

def withArg(value : Byte) : Byte
Invokes with on this instance, passing in the passed value.

def withArg(value : Long) : Long
Invokes with on this instance, passing in the passed value.

def withArg(value : Boolean) : Boolean
Invokes with on this instance, passing in the passed value.

def withArg(value : Float) : Float
Invokes with on this instance, passing in the passed value.

def withArg(value : Double) : Double
Invokes with on this instance, passing in the passed value.

def withArg(value : Char) : Char
Invokes with on this instance, passing in the passed value.

def withArg[T](matcher : org.hamcrest.Matcher[T]) : T
Invokes with on this instance, passing in the passed matcher.

def withArg(matcher : org.hamcrest.Matcher[Int]) : Int
Invokes with on this instance, passing in the passed matcher.

def withArg(matcher : org.hamcrest.Matcher[Short]) : Short
Invokes with on this instance, passing in the passed matcher.

def withArg(matcher : org.hamcrest.Matcher[Byte]) : Byte
Invokes with on this instance, passing in the passed matcher.

def withArg(matcher : org.hamcrest.Matcher[Long]) : Long
Invokes with on this instance, passing in the passed matcher.

def withArg(matcher : org.hamcrest.Matcher[Boolean]) : Boolean
Invokes with on this instance, passing in the passed matcher.

def withArg(matcher : org.hamcrest.Matcher[Float]) : Float
Invokes with on this instance, passing in the passed matcher.

def withArg(matcher : org.hamcrest.Matcher[Double]) : Double
Invokes with on this instance, passing in the passed matcher.

def withArg(matcher : org.hamcrest.Matcher[Char]) : Char
Invokes with on this instance, passing in the passed matcher.


Copyright (C) 2001-2009 Artima, Inc. All rights reserved.