Search in sources :

Example 1 with ResilientActiveKeyValueStoreMock

use of com.baidu.disconf.core.test.zookeeper.mock.ResilientActiveKeyValueStoreMock in project disconf by knightliao.

the class ZookeeperMgrTest method testGetRootChildren.

/**
     * 测试获取Root子节点
     */
@Test
public final void testGetRootChildren() {
    final ZookeeperMgr obj = ZookeeperMgr.getInstance();
    //
    // 注入
    //
    new NonStrictExpectations(obj) {

        {
            ResilientActiveKeyValueStore store = new ResilientActiveKeyValueStoreMock();
            this.setField(obj, "store", store);
        }
    };
    List<String> list = ZookeeperMgr.getInstance().getRootChildren();
    for (String item : list) {
        System.out.println(item);
    }
    Assert.assertTrue(list.size() > 0);
}
Also used : ZookeeperMgr(com.baidu.disconf.core.common.zookeeper.ZookeeperMgr) ResilientActiveKeyValueStore(com.baidu.disconf.core.common.zookeeper.inner.ResilientActiveKeyValueStore) NonStrictExpectations(mockit.NonStrictExpectations) ResilientActiveKeyValueStoreMock(com.baidu.disconf.core.test.zookeeper.mock.ResilientActiveKeyValueStoreMock) Test(org.junit.Test)

Aggregations

ZookeeperMgr (com.baidu.disconf.core.common.zookeeper.ZookeeperMgr)1 ResilientActiveKeyValueStore (com.baidu.disconf.core.common.zookeeper.inner.ResilientActiveKeyValueStore)1 ResilientActiveKeyValueStoreMock (com.baidu.disconf.core.test.zookeeper.mock.ResilientActiveKeyValueStoreMock)1 NonStrictExpectations (mockit.NonStrictExpectations)1 Test (org.junit.Test)1