cloud-software-foundation / c5

c5
Apache License 2.0
12 stars 8 forks source link

UserTabletLeaderBehavior - "Law of Demeter" problem? #302

Open joshua-g opened 10 years ago

joshua-g commented 10 years ago

https://github.com/OhmData/c5/issues/300 describes ReplicatedTabletTest failing, owing to the fact that UserTabletLeaderBehavior is calling C5Server#getModule, which is an unexpected call against the test's C5Server mock object.

UserTabletLeaderBehavior calls getModule as part of a chain of calls that results in it getting the root leader node ID and sending a request to that node. Specifying this behavior in the test, to make it pass, would require four levels of mocks returning mocks. That seems like a smell; it suggests that there should be a way to do this that doesn't require UserTabletLeaderBehavior, and by extension ReplicatedTabletTest, to have so much knowledge about other parts of the system.