Add a static setZooCacheFactory() method to Tables. Then you can set a mock
ZooCacheFactory instance and inject a mock ZooCache.


On Wed, Jun 11, 2014 at 8:21 PM, Mike Drob <[email protected]> wrote:

> I tried passing a MockInstance and a mock(Instance.class) higher in the
> call chain, but it still tried to pull information out of them to make the
> call.
>
> Explicitly mocking that call might work, but I thought there was some issue
> with PowerMock and Java 7 that existed when mocking static methods? Oh,
> also that call is private, so I'd have to mock everything that uses it.
> I'll look into that soon.
>
>
> On Wed, Jun 11, 2014 at 8:16 PM, William Slacum <
> [email protected]> wrote:
>
> > What about mocking that call?
> >
> >
> > On Wed, Jun 11, 2014 at 8:09 PM, Mike Drob <[email protected]> wrote:
> >
> > > When writing unit tests, I indirectly call code that invokes
> > > {{Tables.getZooCache(Instance)}} which sets up a connection to a
> > zookeeper.
> > > However, there is not a server running, so this end up looping forever
> > > until my test times out.
> > >
> > > It looks like my options are...
> > > 1) Make it an IT that uses MAC, so that there is a ZK to connect to
> > > (probably overkill)
> > > 2) Stand up my own ZK (error prone? duplicative?)
> > > 3) Stand up a Curator Testing Server (introduces new dependencies).
> > > 4) Not write tests.
> > >
> > > I'm leaning toward number 3, but was wondering if anybody had thoughts
> on
> > > this, since I feel like that will have a lasting impact on the code.
> > >
> >
>



-- 
// Bill Havanki
// Solutions Architect, Cloudera Govt Solutions
// 443.686.9283

Reply via email to