testing.MockClassRecord Extends
A record that represents all the data associated with a mock replacement of a given class.

Inheritance

Constructor

goog.testing.MockClassRecord(namespaceclassNameoriginalClassproxy)

Parameters

namespace : Object
The namespace in which the mocked class resides.
className : string
The name of the class within the namespace.
originalClass : Function
The original class implementation before it was replaced by a proxy.
proxy : Function
The proxy that replaced the original class.

Instance Methods

Public Protected Private
addMockInstance(argsmock)
Adds a new mock instance mapping. The mapping connects a set of function arguments to a specific mock instance.
Arguments:
args : Array
An array of function arguments.
mock : goog.testing.StrictMock | goog.testing.LooseMock
A mock associated with the supplied arguments.
code »
findMockInstance(args) goog.testing.StrictMock | goog.testing.LooseMock | null
Finds the mock corresponding to a given argument set. Throws an error if there is no appropriate match found.
Arguments:
args : Array
An array of function arguments.
Returns: goog.testing.StrictMock | goog.testing.LooseMock | null  The mock corresponding to a given argument set.
code »
getClassName() string
A getter for this record's class name.
Returns: string  The name of the class referenced by this record.
code »
getNamespace() Object
A getter for this record's namespace.
Returns: Object  The namespace.
code »
getOriginalClass() Function
A getter for the original class.
Returns: Function  The original class implementation before mocking.
code »
getProxy() Function
A getter for the proxy being used as a replacement for the original class.
Returns: Function  The proxy.
code »
getStaticMock() goog.testing.StrictMock | goog.testing.LooseMock | null
A getter for the static mock.
Returns: goog.testing.StrictMock | goog.testing.LooseMock | null  The static mock associated with this record.
code »
reset()
Resets this record by reverting all the mocked classes back to the original implementation and clearing out the mock instance list.
code »
setStaticMock(staticMock)
A setter for the static mock.
Arguments:
staticMock : goog.testing.StrictMock | goog.testing.LooseMock
A mock to associate with the static functions for the referenced class.
code »

Instance Properties

className_ :
The name of the class within the provided namespace.
Code »
instancesByArgs_ :
A mocks that will be constructed by their argument list. The entries are objects with the format {'args': args, 'mock': mock}.
Code »
namespace_ :
A standard closure namespace (e.g. goog.foo.bar) that contains the mock class referenced by this MockClassRecord.
Code »
originalClass_ :
The original class implementation.
Code »
proxy_ :
The proxy being used as a replacement for the original class.
Code »
staticMock_ : goog.testing.LooseMock
A mock associated with the static functions for a given class.
Code »

Package testing

Package Reference