The goog.testing.MockClassRecord Class

goog.testing.MockClassRecord(namespace, className, originalClass, proxy)

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

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.

.addMockInstance(args, mock)

Adds a new mock instance mapping. The mapping connects a set of function arguments to a specific mock instance.

args {Array}
An array of function arguments.
mock {goog.testing.StrictMock|goog.testing.LooseMock}
A mock associated with the supplied arguments.

.findMockInstance(args)

Finds the mock corresponding to a given argument set. Throws an error if there is no appropriate match found.

args {Array}
An array of function arguments.
returns {goog.testing.StrictMock|goog.testing.LooseMock|null}
The mock corresponding to a given argument set.

.getClassName()

A getter for this record's class name.

returns {string}
The name of the class referenced by this record.

.getNamespace()

A getter for this record's namespace.

returns {Object}
The namespace.

.getOriginalClass()

A getter for the original class.

returns {Function}
The original class implementation before mocking.

.getProxy()

A getter for the proxy being used as a replacement for the original class.

returns {Function}
The proxy.

.getStaticMock()

A getter for the static mock.

returns {goog.testing.StrictMock|goog.testing.LooseMock|null}
The static mock associated with this record.

.reset()

Resets this record by reverting all the mocked classes back to the original implementation and clearing out the mock instance list.

.setStaticMock(staticMock)

A setter for the static mock.

staticMock {goog.testing.StrictMock|goog.testing.LooseMock}
A mock to associate with the static functions for the referenced class.