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(); } }