Class goog.testing.StrictMock
code »goog.testing.Mock
└ goog.testing.StrictMock
- All implemented interfaces:
goog.testing.MockInterface
This is a mock that verifies that methods are called in the order that they are specified during the recording phase. Since it verifies order, it follows 'fail fast' semantics. If it detects a deviation from the expectations, it will throw an exception and not wait for verify to be called.
Constructor
Parameters |
---|
|
Instance Methods
Defined in goog.testing.StrictMock
code »$recordCall ( name, args ) ⇒ *
*
Parameters |
---|
|
Defined in goog.testing.Mock
code »$anyTimes ( ) ⇒ !goog.testing.Mock
Allows the expectation to be called any number of times.
!goog.testing.Mock
Returns |
---|
|
code »$argumentsAsString ( args ) ⇒ string
Render the provided argument array to a string to help
clients with debugging tests.
string
Parameters |
---|
|
Returns |
|
Allows the expectation to be called any number of times, as long as it's
called once.
Returns |
---|
|
Allows the expectation to be called 0 or 1 times.
Returns |
---|
|
If this expectation defines a function to be called,
it will be called and its result will be returned.
Otherwise, if the expectation expects to throw, it will throw.
Otherwise, this method will return defined value.
Parameters |
---|
|
Returns |
|
code »$does ( func ) ⇒ !goog.testing.Mock
Specifies a function to call for currently pending expectation.
Note, that using this method overrides declarations made
using $returns() and $throws() methods.
!goog.testing.Mock
Parameters |
---|
|
Returns |
|
code »$initializeFunctions_ ( objectToMock )Initializes the functions on the mock object.
Parameters |
---|
|
code »$maybeThrow ( expectation )If the expectation expects to throw, this method will throw.
Parameters |
---|
|
code »$mockMethod ( name ) ⇒ *
The function that replaces all methods on the mock object.
*
Parameters |
---|
|
Returns |
|
code »$never ( ) ⇒ !goog.testing.Mock
Disallows the expectation from being called.
!goog.testing.Mock
Returns |
---|
|
code »$once ( ) ⇒ !goog.testing.Mock
Allows the expectation to be called exactly once.
!goog.testing.Mock
Returns |
---|
|
code »$recordAndThrow ( ex )Throws an exception and records that an exception was thrown.
code »$registerArgumentListVerifier ( methodName, fn ) ⇒ !goog.testing.Mock
Registers a verfifier function to use when verifying method argument lists.
!goog.testing.Mock
code »$returns ( val ) ⇒ !goog.testing.Mock
Specifies a return value for the currently pending expectation.
!goog.testing.Mock
Parameters |
---|
|
Returns |
|
code »$throwCallException ( name, args, opt_expectation )Throw an exception based on an incorrect method call.
Parameters |
---|
|
code »$throwException ( comment, opt_message )Throws an exception and records that an exception was thrown.
code »$throws ( val ) ⇒ !goog.testing.Mock
Specifies a value for the currently pending expectation to throw.
!goog.testing.Mock
Parameters |
---|
|
Returns |
|
code »$times ( times ) ⇒ !goog.testing.Mock
Specifies the number of times the expectation should be called.
!goog.testing.Mock
Parameters |
---|
|
Returns |
|
code »$verifyCall ( expectation, name, args ) ⇒ boolean
Verifies that a method call matches an expectation.
boolean
Parameters |
---|
|
Returns |
|