And the problem: Classes in other modules are dependent on interfaces of the db module which we can easily mock and have testable instances. But the classes in db module are mostly dependent on HTable’s which is not that easy to mock. Let me rephrase that: They are everything but easy in terms of testing. Trying to stub some methods usually leads writing the whole infrastructure so don’t try to even go there.
And my solution: If my dependency is only to an HTable i should be able to extend and override it’s methods like put/get/delete/getScanner creating a MockHTable and call it a day. But i knew it wasn’t that easy to override that methods.
Wondering if ☞ Mockito wouldn’t help here though.
Original title and link: HBase: Unit Testing Applications (NoSQL databases © myNoSQL)