Taritsyn / JavaScriptEngineSwitcher

JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines. This library allows you to quickly and easily switch to using of another JavaScript engine.
Apache License 2.0
440 stars 49 forks source link

JsEngineSwitcher is not mockable in a unit test #21

Closed Daniel15 closed 7 years ago

Daniel15 commented 7 years ago

I wanted to write a unit test that tests some code that uses JsEngineSwitcher, but it's not possible to mock this class as it's sealed and there's no interface. Could you please make it extend an IJsEngineSwitcher interface so that code that uses it can be unit tested?

Daniel15 commented 7 years ago

Actually I guess there's no benefit in mocking it, I can just use the real JsEngineSwitcher and before each test I can clear out its EngineFactories then register some mock engines. Not ideal, but the constructor isn't public so I can't access it :(

Taritsyn commented 7 years ago

I wanted to write a unit test that tests some code that uses JsEngineSwitcher, but it's not possible to mock this class as it's sealed and there's no interface. Could you please make it extend an IJsEngineSwitcher interface so that code that uses it can be unit tested?

@Daniel15 This feature was implemented in version 3.0.0 Alpha 2.