The goog.testing.MockClassFactory Class

goog.testing.MockClassFactory()

A factory used to create new mock class instances. It is able to generate both static and loose mocks. The MockClassFactory is a singleton since it tracks the classes that have been mocked internally.

.getLooseMockClass(namespace, classToMock, var_args)

Gets a loose mock for a given class.

namespace {Object}
A javascript namespace (e.g. goog.testing).
classToMock {Function}
The class that will be mocked.
var_args {...*}
The arguments associated with this instance's constructor.
returns {goog.testing.LooseMock}
The mock created for the provided class.

.getLooseStaticMock(namespace, classToMock)

Gets a loose mock for the static functions of a given class.

namespace {Object}
A javascript namespace (e.g. goog.testing).
classToMock {Function}
The class whose static functions will be mocked. This should be the original class and not the proxy.
returns {goog.testing.LooseMock}
The mock created for the static functions of the provided class.

.getStrictMockClass(namespace, classToMock, var_args)

Gets a strict mock for a given class.

namespace {Object}
A javascript namespace (e.g. goog.testing).
classToMock {Function}
The class that will be mocked.
var_args {...*}
The arguments associated with this instance's constructor.
returns {goog.testing.StrictMock}
The mock created for the provided class.

.getStrictStaticMock(namespace, classToMock)

Gets a strict mock for the static functions of a given class.

namespace {Object}
A javascript namespace (e.g. goog.testing).
classToMock {Function}
The class whose static functions will be mocked. This should be the original class and not the proxy.
returns {goog.testing.StrictMock}
The mock created for the static functions of the provided class.

.reset()

Resests the factory by reverting all mocked classes to their original implementations and removing all MockClassRecords.