package org.hyperledger.indy.sdk.pool;

import org.hyperledger.indy.sdk.IndyException;
import org.hyperledger.indy.sdk.IndyIntegrationTest;
import org.hyperledger.indy.sdk.utils.PoolUtils;
import org.junit.Test;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

import static org.junit.Assert.assertNotNull;

public class ClosePoolTest extends IndyIntegrationTest {

	@Test
	public void testClosePoolWorks() throws IndyException, ExecutionException, InterruptedException, IOException {
		Pool pool = PoolUtils.createAndOpenPoolLedger();
		assertNotNull(pool);
		openedPools.add(pool);

		pool.closePoolLedger().get();
		openedPools.remove(pool);
	}
}

@@ -33,16 +33,109 @@
 .pool;%0A%0A
+import org.hyperledger.indy.sdk.ErrorCode;%0Aimport org.hyperledger.indy.sdk.ErrorCodeMatcher;%0A
 import o
@@ -762,11 +762,801 @@
 ool);%0A%09%7D
+%0A%0A%09@Test%0A%09public void testClosePoolWorksForTwice() throws IndyException, ExecutionException, InterruptedException, IOException %7B%0A%09%09thrown.expectCause(new ErrorCodeMatcher(ErrorCode.PoolLedgerInvalidPoolHandle));%0A%0A%09%09Pool pool = PoolUtils.createAndOpenPoolLedger();%0A%09%09assertNotNull(pool);%0A%09%09openedPools.add(pool);%0A%0A%09%09pool.closePoolLedger().get();%0A%09%09openedPools.remove(pool);%0A%09%09pool.closePoolLedger().get();%0A%09%7D%0A%0A%09@Test%0A%09public void testClosePoolWorksForReopenAfterClose() throws IndyException, ExecutionException, InterruptedException, IOException %7B%0A%09%09String poolName = PoolUtils.createPoolLedgerConfig();%0A%0A%09%09Pool pool = Pool.openPoolLedger(poolName, null).get();%0A%09%09assertNotNull(pool);%0A%09%09openedPools.add(pool);%0A%0A%09%09pool.closePoolLedger().get();%0A%0A%09%09Pool.openPoolLedger(poolName, null).get();%0A%09%7D
 %0A%7D%0A

Add more tests for ClosePool.