Mocking Methods

Come mock with me!
Once you have created a mock object, you can use it like the real object, which will respond exactly as it was coded. However, you can override its behavior by using the mocking methods placed on the mocked object at run-time. The methods that you can call upon in your object are the following (we will review them in detail later):
Method Name
Return Type
Description
$()
Object
Used to mock a method on the mock object that can return, throw or be a void method.
$args()
Object
Mock 1 or more arguments in sequential or named order. Must be called concatenated to a $() call and must be followed by a concatenated $results() call so the results are matched to specific arguments.
$getProperty(name, scope)
any
Retrieve any public or private internal state variable so you can do assertions and more mocking.
$property()
Object
Mock a property in the object on any scope.
querySim()
query
to denote columns. Ex: id, name 1 Luis Majano 2 Joe Louis
$results()
Object
Mock 1 or more results of a mock method call must be chained to a $() or $().$args() call
$spy( method )
Object
Spy on a specific method to check how often it has been called and with what arguments and results.
$throws(
type,
message,
datail,
errorcode
)
Object
This method tells MockBox that you want to mock a method that will throw an exception when called.