Generally, I think a better way to do this is to use a standard mock object framework. Then you don't have to fake up an interface.
But the original poster probably has a need to do integration tests more than unit tests. In such tests, they need to test against a real ZK to make sure that their assumptions about the semantics of ZK are valid. On Mon, Oct 18, 2010 at 8:53 AM, David Rosenstrauch <dar...@darose.net>wrote: > Consequently, the way I write my code for ZooKeeper is against a more > generic interface that provides operations for open, close, getData, and > setData. When unit testing, I substitute in a "dummy" implementation that > just stores data in memory (i.e., a HashMap); when running live code I use > an implementation that talks to ZooKeeper. >