@johanblumenberg/ts-mockito
Version:
Mocking library for TypeScript
41 lines • 1.8 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ThrowErrorMethodStub = void 0;
var ArgsToMatchersValidator_1 = require("../matcher/ArgsToMatchersValidator");
var AbstractMethodStub_1 = require("./AbstractMethodStub");
var ThrowErrorMethodStub = (function (_super) {
__extends(ThrowErrorMethodStub, _super);
function ThrowErrorMethodStub(groupIndex, matchers, error, oneshot) {
if (oneshot === void 0) { oneshot = false; }
var _this = _super.call(this, groupIndex, oneshot) || this;
_this.matchers = matchers;
_this.error = error;
_this.validator = new ArgsToMatchersValidator_1.ArgsToMatchersValidator();
return _this;
}
ThrowErrorMethodStub.prototype.isApplicable = function (args) {
return this.validator.validate(this.matchers, args);
};
ThrowErrorMethodStub.prototype.execute = function (args) {
throw this.error;
};
ThrowErrorMethodStub.prototype.getValue = function () {
return null;
};
return ThrowErrorMethodStub;
}(AbstractMethodStub_1.AbstractMethodStub));
exports.ThrowErrorMethodStub = ThrowErrorMethodStub;
//# sourceMappingURL=ThrowErrorMethodStub.js.map