SqlLifecycleTest is structured poorly. Rather than verify the contract that this class must provide, the code uses mocks to verify the implementation. That is, the tests verify that SqlLifecycleTest makes certain calls in a certain order to DruidPlanner.
In general, implementation evolves, but the contract (interface) tends to evolve slower. Tests want to verify that SqlLifecycle does what it advertises to do. Testing the implementation leads to brittle tests. Further, such test don't actually tell us that the class performs its function, only that it is going through the motions.
This test should be rewritten to use a real DruidPlanner (which enforces its own lifecycle) and to verify that each public method does what it advertises to do. Omit the part of the tests which verify implementation.
SqlLifecycleTestis structured poorly. Rather than verify the contract that this class must provide, the code uses mocks to verify the implementation. That is, the tests verify thatSqlLifecycleTestmakes certain calls in a certain order toDruidPlanner.In general, implementation evolves, but the contract (interface) tends to evolve slower. Tests want to verify that
SqlLifecycledoes what it advertises to do. Testing the implementation leads to brittle tests. Further, such test don't actually tell us that the class performs its function, only that it is going through the motions.This test should be rewritten to use a real
DruidPlanner(which enforces its own lifecycle) and to verify that each public method does what it advertises to do. Omit the part of the tests which verify implementation.