curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Check Peck <>
Subject How to mock "create" method of CuratorFramework using jmockit?
Date Mon, 09 Jun 2014 04:30:21 GMT
I am using Netflix Curator library as I am working with Zookeeper. And now
I am trying to write junit test for my code base so I need to mock some of
the codes for Curator library.

I am using jmockit library for mocking.

This is my below code which creates a simple znode in the zookeeper.

    CuratorFramework client = CuratorClient.createSimple("locahost:2181");

    // line 1

Now I am trying to mock `create` method of `CuratorFramework` using
`jmockit` so that it doesn't create the actual znode in Zookeeper.

But not able to understand how can I mock it properly?

        new MockUp<CuratorFramework>() {
            public CreateBuilder create() {

                // what should I return here so that line 1 doesn't
                // create actual znode in zookeeper.

Any suggestions will be of great help?

View raw message