org.scalatest.mock

JMockExpectations

class JMockExpectations extends Expectations

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"))

attributes: final

Inherits

  1. Expectations
  2. ActionClause
  3. ArgumentConstraintPhrases
  4. CardinalityClause
  5. ExpectationBuilder
  6. AnyRef
  7. Any

Value Members

  1. def allowing[T](arg0: T): T

  2. def allowing(arg0: org.hamcrest.Matcher[_]): MethodClause

  3. def atLeast(arg0: Int): ReceiverClause

  4. def atMost(arg0: Int): ReceiverClause

  5. def between(arg0: Int, arg1: Int): ReceiverClause

  6. def buildExpectations(arg0: Action, arg1: ExpectationCollector): Unit

  7. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an equivalence relation:

    • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
    • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
    • It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef ⇐ Any
  8. def exactly(arg0: Int): ReceiverClause

  9. def hashCode(): Int

    Returns a hash code value for the object

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    definition classes: AnyRef ⇐ Any
  10. def ignoring(arg0: org.hamcrest.Matcher[_]): MethodClause

  11. def ignoring[T](arg0: T): T

  12. def inSequence(arg0: Sequence): Unit

  13. def inSequences(arg0: <repeated...>[Sequence]): Unit

  14. def never[T](arg0: T): T

  15. def one[T](arg0: T): T

  16. def oneOf[T](arg0: T): T

  17. def then(arg0: State): Unit

  18. def toString(): String

    Returns a string representation of the object

    Returns a string representation of the object.

    The default representation is platform dependent.

    definition classes: AnyRef ⇐ Any
  19. def when(arg0: StatePredicate): Unit

  20. def will(arg0: Action): Unit

  21. def with[T](arg0: T): T

  22. def with(arg0: Double): Double

  23. def with(arg0: Float): Float

  24. def with(arg0: Long): Long

  25. def with(arg0: Int): Int

  26. def with(arg0: Char): Char

  27. def with(arg0: Short): Short

  28. def with(arg0: Byte): Byte

  29. def with(arg0: Boolean): Boolean

  30. def with(arg0: Matcher[Double]): Double

  31. def with(arg0: Matcher[Float]): Float

  32. def with(arg0: Matcher[Long]): Long

  33. def with(arg0: Matcher[Integer]): Int

  34. def with(arg0: Matcher[Character]): Char

  35. def with(arg0: Matcher[Short]): Short

  36. def with(arg0: Matcher[Byte]): Byte

  37. def with(arg0: Matcher[Boolean]): Boolean

  38. def with[T](arg0: Matcher[T]): T

  39. def withArg(matcher: Matcher[Char]): Char

    Invokes with on this instance, passing in the passed matcher

    Invokes with on this instance, passing in the passed matcher.

  40. def withArg(matcher: Matcher[Double]): Double

    Invokes with on this instance, passing in the passed matcher

    Invokes with on this instance, passing in the passed matcher.

  41. def withArg(matcher: Matcher[Float]): Float

    Invokes with on this instance, passing in the passed matcher

    Invokes with on this instance, passing in the passed matcher.

  42. def withArg(matcher: Matcher[Boolean]): Boolean

    Invokes with on this instance, passing in the passed matcher

    Invokes with on this instance, passing in the passed matcher.

  43. def withArg(matcher: Matcher[Long]): Long

    Invokes with on this instance, passing in the passed matcher

    Invokes with on this instance, passing in the passed matcher.

  44. def withArg(matcher: Matcher[Byte]): Byte

    Invokes with on this instance, passing in the passed matcher

    Invokes with on this instance, passing in the passed matcher.

  45. def withArg(matcher: Matcher[Short]): Short

    Invokes with on this instance, passing in the passed matcher

    Invokes with on this instance, passing in the passed matcher.

  46. def withArg(matcher: Matcher[Int]): Int

    Invokes with on this instance, passing in the passed matcher

    Invokes with on this instance, passing in the passed matcher.

  47. def withArg[T](matcher: Matcher[T]): T

    Invokes with on this instance, passing in the passed matcher

    Invokes with on this instance, passing in the passed matcher.

  48. def withArg(value: Char): Char

    Invokes with on this instance, passing in the passed value

    Invokes with on this instance, passing in the passed value.

  49. def withArg(value: Double): Double

    Invokes with on this instance, passing in the passed value

    Invokes with on this instance, passing in the passed value.

  50. def withArg(value: Float): Float

    Invokes with on this instance, passing in the passed value

    Invokes with on this instance, passing in the passed value.

  51. def withArg(value: Boolean): Boolean

    Invokes with on this instance, passing in the passed value

    Invokes with on this instance, passing in the passed value.

  52. def withArg(value: Long): Long

    Invokes with on this instance, passing in the passed value

    Invokes with on this instance, passing in the passed value.

  53. def withArg(value: Byte): Byte

    Invokes with on this instance, passing in the passed value

    Invokes with on this instance, passing in the passed value.

  54. def withArg(value: Short): Short

    Invokes with on this instance, passing in the passed value

    Invokes with on this instance, passing in the passed value.

  55. def withArg(value: Int): Int

    Invokes with on this instance, passing in the passed value

    Invokes with on this instance, passing in the passed value.

  56. def withArg[T](value: T): T

    Invokes with on this instance, passing in the passed value

    Invokes with on this instance, passing in the passed value.

Instance constructors

  1. new JMockExpectations()