com.mockobjects.dynamic

## Class Mock

- java.lang.Object
- - com.mockobjects.dynamic.Mock

- All Implemented Interfaces:
    Verifiable, java.lang.reflect.InvocationHandler
  Direct Known Subclasses:
    OrderedMock

      public class Mock
      extends java.lang.Object
      implements java.lang.reflect.InvocationHandler, Verifiable

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Mock(CallFactory callFactory, CallableAddable callableAddable, java.lang.Class mockedClass, java.lang.String name)`
    `Mock(java.lang.Class mockedClass)`
    `Mock(java.lang.Class mockedClass, java.lang.String nonDefaultName)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `className(java.lang.Class c)`
    `void` | `expect(java.lang.String methodName)`
    `void` | `expect(java.lang.String methodName, CallSequence deprecated)` Deprecated. @see OrderedMock
    `void` | `expect(java.lang.String methodName, ConstraintMatcher args)`
    `void` | `expect(java.lang.String methodName, java.lang.Object singleEqualArg)`
    `void` | `expectAndReturn(java.lang.String methodName, boolean result)`
    `void` | `expectAndReturn(java.lang.String methodName, CallSequence deprecated, java.lang.Object result)` Deprecated. @see OrderedMock
    `void` | `expectAndReturn(java.lang.String methodName, ConstraintMatcher args, boolean result)`
    `void` | `expectAndReturn(java.lang.String methodName, ConstraintMatcher args, int result)`
    `void` | `expectAndReturn(java.lang.String methodName, ConstraintMatcher args, java.lang.Object result)`
    `void` | `expectAndReturn(java.lang.String methodName, int result)`
    `void` | `expectAndReturn(java.lang.String methodName, java.lang.Object result)`
    `void` | `expectAndReturn(java.lang.String methodName, java.lang.Object singleEqualArg, boolean result)`
    `void` | `expectAndReturn(java.lang.String methodName, java.lang.Object singleEqualArg, int result)`
    `void` | `expectAndReturn(java.lang.String methodName, java.lang.Object singleEqualArg, java.lang.Object result)`
    `void` | `expectAndThrow(java.lang.String methodName, CallSequence deprecated, java.lang.Throwable throwable)` Deprecated. @see OrderedMock
    `void` | `expectAndThrow(java.lang.String methodName, ConstraintMatcher args, java.lang.Throwable exception)`
    `void` | `expectAndThrow(java.lang.String methodName, java.lang.Object singleEqualArg, java.lang.Throwable exception)`
    `void` | `expectAndThrow(java.lang.String methodName, java.lang.Throwable exception)`
    `void` | `expectNotCalled(java.lang.String methodName)` Deprecated. Not required, as if methodName is called, you will get a an exception
    `void` | `expectVoid(java.lang.String methodName)` Deprecated. @see expect
    `void` | `expectVoid(java.lang.String methodName, ConstraintMatcher args)` Deprecated. @see expect
    `void` | `expectVoid(java.lang.String methodName, java.lang.Object equalArg)` Deprecated. @see expect
    `java.lang.String` | `getMockName()`
    `java.lang.Object` | `invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)`
    `void` | `matchAndReturn(java.lang.String methodName, boolean result)`
    `void` | `matchAndReturn(java.lang.String methodName, boolean singleEqualArg, java.lang.Object result)`
    `void` | `matchAndReturn(java.lang.String methodName, ConstraintMatcher args, boolean result)`
    `void` | `matchAndReturn(java.lang.String methodName, ConstraintMatcher args, int result)`
    `void` | `matchAndReturn(java.lang.String methodName, ConstraintMatcher args, java.lang.Object result)`
    `void` | `matchAndReturn(java.lang.String methodName, int result)`
    `void` | `matchAndReturn(java.lang.String methodName, int singleEqualArg, java.lang.Object result)`
    `void` | `matchAndReturn(java.lang.String methodName, java.lang.Object result)`
    `void` | `matchAndReturn(java.lang.String methodName, java.lang.Object singleEqualArg, boolean result)`
    `void` | `matchAndReturn(java.lang.String methodName, java.lang.Object singleEqualArg, int result)`
    `void` | `matchAndReturn(java.lang.String methodName, java.lang.Object singleEqualArg, java.lang.Object result)`
    `void` | `matchAndThrow(java.lang.String methodName, boolean singleEqualArg, java.lang.Throwable throwable)`
    `void` | `matchAndThrow(java.lang.String methodName, ConstraintMatcher args, java.lang.Throwable throwable)`
    `void` | `matchAndThrow(java.lang.String methodName, int singleEqualArg, java.lang.Throwable throwable)`
    `void` | `matchAndThrow(java.lang.String methodName, java.lang.Object singleEqualArg, java.lang.Throwable throwable)`
    `void` | `matchAndThrow(java.lang.String methodName, java.lang.Throwable throwable)`
    `static java.lang.String` | `mockNameFromClass(java.lang.Class c)`
    `java.lang.Object` | `proxy()`
    `void` | `reset()`
    `java.lang.String` | `toString()`
    `void` | `verify()` Throw an AssertionFailedException if any expectations have not been met.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Mock

          public Mock(CallFactory callFactory,
                      CallableAddable callableAddable,
                      java.lang.Class mockedClass,
                      java.lang.String name)

    - #### Mock

          public Mock(java.lang.Class mockedClass,
                      java.lang.String nonDefaultName)

    - #### Mock

          public Mock(java.lang.Class mockedClass)

  - ### Method Detail

    - #### reset

          public void reset()

    - #### mockNameFromClass

          public static java.lang.String mockNameFromClass(java.lang.Class c)

    - #### className

          public static java.lang.String className(java.lang.Class c)

    - #### getMockName

          public java.lang.String getMockName()

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### proxy

          public java.lang.Object proxy()

    - #### invoke

          public java.lang.Object invoke(java.lang.Object proxy,
                                         java.lang.reflect.Method method,
                                         java.lang.Object[] args)
                                  throws java.lang.Throwable

      Specified by:
        `invoke` in interface `java.lang.reflect.InvocationHandler`
      Throws:
        `java.lang.Throwable`

    - #### verify

          public void verify()

      Description copied from interface: `Verifiable`
      Throw an AssertionFailedException if any expectations have not been met.
      Specified by:
        `verify` in interface `Verifiable`

    - #### expect

          public void expect(java.lang.String methodName)

    - #### expect

          public void expect(java.lang.String methodName,
                             java.lang.Object singleEqualArg)

    - #### expect

          public void expect(java.lang.String methodName,
                             ConstraintMatcher args)

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      java.lang.Object result)

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      boolean result)

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      int result)

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      java.lang.Object singleEqualArg,
                                      java.lang.Object result)

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      java.lang.Object singleEqualArg,
                                      boolean result)

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      java.lang.Object singleEqualArg,
                                      int result)

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      ConstraintMatcher args,
                                      java.lang.Object result)

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      ConstraintMatcher args,
                                      boolean result)

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      ConstraintMatcher args,
                                      int result)

    - #### expectAndThrow

          public void expectAndThrow(java.lang.String methodName,
                                     java.lang.Throwable exception)

    - #### expectAndThrow

          public void expectAndThrow(java.lang.String methodName,
                                     java.lang.Object singleEqualArg,
                                     java.lang.Throwable exception)

    - #### expectAndThrow

          public void expectAndThrow(java.lang.String methodName,
                                     ConstraintMatcher args,
                                     java.lang.Throwable exception)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     java.lang.Object result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     boolean result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     int result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     java.lang.Object singleEqualArg,
                                     java.lang.Object result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     boolean singleEqualArg,
                                     java.lang.Object result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     int singleEqualArg,
                                     java.lang.Object result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     java.lang.Object singleEqualArg,
                                     boolean result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     java.lang.Object singleEqualArg,
                                     int result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     ConstraintMatcher args,
                                     java.lang.Object result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     ConstraintMatcher args,
                                     boolean result)

    - #### matchAndReturn

          public void matchAndReturn(java.lang.String methodName,
                                     ConstraintMatcher args,
                                     int result)

    - #### matchAndThrow

          public void matchAndThrow(java.lang.String methodName,
                                    java.lang.Throwable throwable)

    - #### matchAndThrow

          public void matchAndThrow(java.lang.String methodName,
                                    java.lang.Object singleEqualArg,
                                    java.lang.Throwable throwable)

    - #### matchAndThrow

          public void matchAndThrow(java.lang.String methodName,
                                    boolean singleEqualArg,
                                    java.lang.Throwable throwable)

    - #### matchAndThrow

          public void matchAndThrow(java.lang.String methodName,
                                    int singleEqualArg,
                                    java.lang.Throwable throwable)

    - #### matchAndThrow

          public void matchAndThrow(java.lang.String methodName,
                                    ConstraintMatcher args,
                                    java.lang.Throwable throwable)

    - #### expect

          public void expect(java.lang.String methodName,
                             CallSequence deprecated)

      Deprecated. @see OrderedMock

    - #### expectAndReturn

          public void expectAndReturn(java.lang.String methodName,
                                      CallSequence deprecated,
                                      java.lang.Object result)

      Deprecated. @see OrderedMock

    - #### expectAndThrow

          public void expectAndThrow(java.lang.String methodName,
                                     CallSequence deprecated,
                                     java.lang.Throwable throwable)

      Deprecated. @see OrderedMock

    - #### expectVoid

          public void expectVoid(java.lang.String methodName,
                                 ConstraintMatcher args)

      Deprecated. @see expect

    - #### expectVoid

          public void expectVoid(java.lang.String methodName,
                                 java.lang.Object equalArg)

      Deprecated. @see expect

    - #### expectVoid

          public void expectVoid(java.lang.String methodName)

      Deprecated. @see expect

    - #### expectNotCalled

          public void expectNotCalled(java.lang.String methodName)

      Deprecated. Not required, as if methodName is called, you will get a an exception

Copyright © 2002 Mock Objects. All Rights Reserved.