#22 Difficult to unit test: Remove final on public methods

API (15)

It is extremely difficult to unit test with the Informa
code because to many of the public methods have been
made final.

For instance:

One common way to unit test code that might use the
library is to create a "fake" object that overrides the
methods of the original in order to inject it into the
code under test.

e.g. If I'm writing code that contains logic for the
Poller class, I'll test it by creating a FakePoller
(public class FakePoller extends Poller). Of course,
since this is a unit test, I don't actually want Poller
to do anything, I just want the code under test to
think it's using a Poller so I can control its inputs
and outputs.

Please remove the unnecessary final designation on
public methods so the API can be better used when unit
testing the code that uses it.


Log in to post a comment.