Package com.mockobjects.dynamic

# Class Mock

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

All Implemented Interfaces:
  `Verifiable`, `InvocationHandler`

Direct Known Subclasses:
  `OrderedMock`

public class Mock extends Object implements InvocationHandler, Verifiable

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`static String`
`className(Class c)`
`void`
`expect(String methodName)`
`void`
`expect(String methodName, CallSequence deprecated)`
Deprecated.
@see OrderedMock
`void`
`expect(String methodName, ConstraintMatcher args)`
`void`
`expect(String methodName, Object singleEqualArg)`
`void`
`expectAndReturn(String methodName, boolean result)`
`void`
`expectAndReturn(String methodName, int result)`
`void`
`expectAndReturn(String methodName, CallSequence deprecated, Object result)`
Deprecated.
@see OrderedMock
`void`
`expectAndReturn(String methodName, ConstraintMatcher args, boolean result)`
`void`
`expectAndReturn(String methodName, ConstraintMatcher args, int result)`
`void`
`expectAndReturn(String methodName, ConstraintMatcher args, Object result)`
`void`
`expectAndReturn(String methodName, Object result)`
`void`
`expectAndReturn(String methodName, Object singleEqualArg, boolean result)`
`void`
`expectAndReturn(String methodName, Object singleEqualArg, int result)`
`void`
`expectAndReturn(String methodName, Object singleEqualArg, Object result)`
`void`
`expectAndThrow(String methodName, CallSequence deprecated, Throwable throwable)`
Deprecated.
@see OrderedMock
`void`
`expectAndThrow(String methodName, ConstraintMatcher args, Throwable exception)`
`void`
`expectAndThrow(String methodName, Object singleEqualArg, Throwable exception)`
`void`
`expectAndThrow(String methodName, Throwable exception)`
`void`
`expectNotCalled(String methodName)`
Deprecated.
Not required, as if methodName is called, you will get a an exception
`void`
`expectVoid(String methodName)`
Deprecated.
@see expect
`void`
`expectVoid(String methodName, ConstraintMatcher args)`
Deprecated.
@see expect
`void`
`expectVoid(String methodName, Object equalArg)`
Deprecated.
@see expect
`String`
`getMockName()`
`Object`
`invoke(Object proxy, Method method, Object[] args)`
`void`
`matchAndReturn(String methodName, boolean result)`
`void`
`matchAndReturn(String methodName, boolean singleEqualArg, Object result)`
`void`
`matchAndReturn(String methodName, int result)`
`void`
`matchAndReturn(String methodName, int singleEqualArg, Object result)`
`void`
`matchAndReturn(String methodName, ConstraintMatcher args, boolean result)`
`void`
`matchAndReturn(String methodName, ConstraintMatcher args, int result)`
`void`
`matchAndReturn(String methodName, ConstraintMatcher args, Object result)`
`void`
`matchAndReturn(String methodName, Object result)`
`void`
`matchAndReturn(String methodName, Object singleEqualArg, boolean result)`
`void`
`matchAndReturn(String methodName, Object singleEqualArg, int result)`
`void`
`matchAndReturn(String methodName, Object singleEqualArg, Object result)`
`void`
`matchAndThrow(String methodName, boolean singleEqualArg, Throwable throwable)`
`void`
`matchAndThrow(String methodName, int singleEqualArg, Throwable throwable)`
`void`
`matchAndThrow(String methodName, ConstraintMatcher args, Throwable throwable)`
`void`
`matchAndThrow(String methodName, Object singleEqualArg, Throwable throwable)`
`void`
`matchAndThrow(String methodName, Throwable throwable)`
`static String`
`mockNameFromClass(Class c)`
`Object`
`proxy()`
`void`
`reset()`
`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 Details

### Mock

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

### Mock

public Mock(Class mockedClass, String nonDefaultName)

### Mock

public Mock(Class mockedClass)

## Method Details

### reset

public void reset()

### mockNameFromClass

public static String mockNameFromClass(Class c)

### className

public static String className(Class c)

### getMockName

public String getMockName()

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### proxy

public Object proxy()

### invoke

public Object invoke(Object proxy, Method method, Object[] args) throws Throwable

Specified by:
  `invoke` in interface `InvocationHandler`
Throws:
  `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(String methodName)

### expect

public void expect(String methodName, Object singleEqualArg)

### expect

public void expect(String methodName, ConstraintMatcher args)

### expectAndReturn

public void expectAndReturn(String methodName, Object result)

### expectAndReturn

public void expectAndReturn(String methodName, boolean result)

### expectAndReturn

public void expectAndReturn(String methodName, int result)

### expectAndReturn

public void expectAndReturn(String methodName, Object singleEqualArg, Object result)

### expectAndReturn

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

### expectAndReturn

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

### expectAndReturn

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

### expectAndReturn

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

### expectAndReturn

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

### expectAndThrow

public void expectAndThrow(String methodName, Throwable exception)

### expectAndThrow

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

### expectAndThrow

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

### matchAndReturn

public void matchAndReturn(String methodName, Object result)

### matchAndReturn

public void matchAndReturn(String methodName, boolean result)

### matchAndReturn

public void matchAndReturn(String methodName, int result)

### matchAndReturn

public void matchAndReturn(String methodName, Object singleEqualArg, Object result)

### matchAndReturn

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

### matchAndReturn

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

### matchAndReturn

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

### matchAndReturn

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

### matchAndReturn

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

### matchAndReturn

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

### matchAndReturn

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

### matchAndThrow

public void matchAndThrow(String methodName, Throwable throwable)

### matchAndThrow

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

### matchAndThrow

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

### matchAndThrow

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

### matchAndThrow

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

### expect

public void expect(String methodName, CallSequence deprecated)
Deprecated.
@see OrderedMock

### expectAndReturn

public void expectAndReturn(String methodName, CallSequence deprecated, Object result)
Deprecated.
@see OrderedMock

### expectAndThrow

public void expectAndThrow(String methodName, CallSequence deprecated, Throwable throwable)
Deprecated.
@see OrderedMock

### expectVoid

public void expectVoid(String methodName, ConstraintMatcher args)
Deprecated.
@see expect

### expectVoid

public void expectVoid(String methodName, Object equalArg)
Deprecated.
@see expect

### expectVoid

public void expectVoid(String methodName)
Deprecated.
@see expect

### expectNotCalled

public void expectNotCalled(String methodName)
Deprecated.
Not required, as if methodName is called, you will get a an exception