org.jmock

Class MockObjectTestCase

Known Direct Subclasses:
MockObjectTestCase

public abstract class MockObjectTestCase
extends MockObjectSupportTestCase

A base class for tests that use Mock Objects. This class provides methods for creating mock objects and expectations and automatically verifying mock objects after the test has run, but before the test fixture has been torn down.

Field Summary

Fields inherited from class org.jmock.core.MockObjectSupportTestCase

ANYTHING, NOT_NULL, NULL

Constructor Summary

MockObjectTestCase()
MockObjectTestCase(String name)

Method Summary

InvocationMatcher
atLeastOnce()
String
defaultMockNameForType(Class mockedType)
Mock
mock(Class mockedType)
Mock
mock(Class mockedType, String roleName)
InvocationMatcher
never()
protected DynamicMock
newCoreMock(Class mockedType, String roleName)
Stub
onConsecutiveCalls(Stub stub1, Stub stub2)
Stub
onConsecutiveCalls(Stub stub1, Stub stub2, Stub stub3)
Stub
onConsecutiveCalls(Stub stub1, Stub stub2, Stub stub3, Stub stub4)
InvocationMatcher
once()
Stub
returnValue(Object o)
Stub
returnValue(boolean result)
Stub
returnValue(byte result)
Stub
returnValue(char result)
Stub
returnValue(double result)
Stub
returnValue(float result)
Stub
returnValue(int result)
Stub
returnValue(long result)
Stub
returnValue(short result)
Stub
throwException(Throwable throwable)

Methods inherited from class org.jmock.core.MockObjectSupportTestCase

and, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, isA, newDummy, newDummy, newDummy, not, or, same, stringContains

Methods inherited from class org.jmock.core.VerifyingTestCase

registerToVerify, runBare, unregisterToVerify, verify

Constructor Details

MockObjectTestCase

public MockObjectTestCase()

MockObjectTestCase

public MockObjectTestCase(String name)

Method Details

atLeastOnce

public InvocationMatcher atLeastOnce()

defaultMockNameForType

public String defaultMockNameForType(Class mockedType)

mock

public Mock mock(Class mockedType)

mock

public Mock mock(Class mockedType,
                 String roleName)

never

public InvocationMatcher never()

newCoreMock

protected DynamicMock newCoreMock(Class mockedType,
                                  String roleName)

onConsecutiveCalls

public Stub onConsecutiveCalls(Stub stub1,
                               Stub stub2)

onConsecutiveCalls

public Stub onConsecutiveCalls(Stub stub1,
                               Stub stub2,
                               Stub stub3)

onConsecutiveCalls

public Stub onConsecutiveCalls(Stub stub1,
                               Stub stub2,
                               Stub stub3,
                               Stub stub4)

once

public InvocationMatcher once()

returnValue

public Stub returnValue(Object o)

returnValue

public Stub returnValue(boolean result)

returnValue

public Stub returnValue(byte result)

returnValue

public Stub returnValue(char result)

returnValue

public Stub returnValue(double result)

returnValue

public Stub returnValue(float result)

returnValue

public Stub returnValue(int result)

returnValue

public Stub returnValue(long result)

returnValue

public Stub returnValue(short result)

throwException

public Stub throwException(Throwable throwable)