插件开发工具库,推荐依赖该工具库。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
1.0 KiB

package com.fanruan.api.cluster.state;
import com.fr.store.impl.accessor.FineStorePool;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
/**
* @author Dylan.Liu
* @version 10.0
* Created by Dylan.Liu on 2021/1/19
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({FineStorePool.class})
public class StoreTemplateKitTest {
@Test
public void testClose() throws Exception {
// test
FineStorePool fineStorePool = mock(FineStorePool.class);
fineStorePool.close();
expectLastCall().times(1);
PowerMock.mockStaticPartial(FineStorePool.class, "getPool");
expect(FineStorePool.getPool()).andReturn(fineStorePool).times(1);
PowerMock.replayAll();
StoreTemplateKit.close();
PowerMock.verifyAll();
}
}