You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.
Our preference for Builder being final is to prevent incompatibilities across newer versions of Fenzo any Builders users create by extending it, Migrating such users to new versions of Fenzo will be painful if we allowed such extensibility. We also see similar pattern used in other places. For example, Protobuf generated Builders are final.
My understanding of this stackoverflow link is that you should be able to mock it.
The link suggests using PowerMock, which adds complexity (for example, I was unable to use it in a certain scalatest scenario).
My scenario is that a certain class is provided an instance of TaskScheduler.Builder in its constructor. That class sets some of the callbacks (withLeaseRejectAction) on the builder, then builds and uses the scheduler. In the unit test for this class, I'd like to provide a mock builder, so that I can provide a mock scheduler to the class while also capturing the lease reject callback to test it. Despite your objections, a non-final builder would really help with this scenario. Go ahead and close if you still object, otherwise I'll send a patch.
For mocking purposes (w/ Mockito) it would be handy if the builder weren't final.
The text was updated successfully, but these errors were encountered: