goog.testing.MockClassFactory
Classgoog.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
}
classToMock
{Function
}
var_args
{...*}
goog.testing.LooseMock
}
.getLooseStaticMock(namespace, classToMock)
Gets a loose mock for the static functions of a given class.
namespace
{Object
}
classToMock
{Function
}
goog.testing.LooseMock
}
.getStrictMockClass(namespace, classToMock, var_args)
Gets a strict mock for a given class.
namespace
{Object
}
classToMock
{Function
}
var_args
{...*}
goog.testing.StrictMock
}
.getStrictStaticMock(namespace, classToMock)
Gets a strict mock for the static functions of a given class.
namespace
{Object
}
classToMock
{Function
}
goog.testing.StrictMock
}
.reset()
Resests the factory by reverting all mocked classes to their original implementations and removing all MockClassRecords.