package org.jdbchub.jdbc;

import org.junit.Test;
import org.skife.jdbi.v2.DBI;
import org.skife.jdbi.v2.Handle;

import java.sql.Connection;
import java.util.List;

import static org.jdbchub.JdbcHubTestUtils.allItems;
import static org.jdbchub.JdbcHubTestUtils.createTestDatabases;
import static org.junit.Assert.assertEquals;

public class JdbcConnectionTest {

	@Test
	public void testQuery() {
		List<Connection> cons = createTestDatabases();
		JdbcConnection c = new JdbcConnection(cons);
		try (Handle h = DBI.open(c)) {
			assertEquals(allItems(), h.select("select * from test_items"));
		}
	}

}
@@ -106,17 +106,16 @@
 Handle;%0A
-%0A
 import j
@@ -157,17 +157,16 @@
 l.List;%0A
-%0A
 import s
@@ -305,28 +305,17 @@
 .Assert.
-assertEquals
+*
 ;%0A%0Apubli
@@ -507,16 +507,16 @@
 n(c)) %7B%0A
-
 %09%09%09asser
@@ -582,9 +582,422 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09@Test%0A%09public void testClose() throws Exception %7B%0A%09%09List%3CConnection%3E cons = createTestDatabases();%0A%09%09try (JdbcConnection c = new JdbcConnection(cons)) %7B%0A%09%09%09assertFalse(c.isClosed());%0A%0A%09%09%09cons.get(0).close();%0A%09%09%09assertTrue(c.isClosed());%0A%09%09%09assertFalse(c.map(Connection::isClosed).allMatch(r -%3E r));%0A%0A%09%09%09c.close();%0A%09%09%09assertTrue(c.isClosed());%0A%09%09%09assertTrue(c.map(Connection::isClosed).allMatch(r -%3E r));%0A%09%09%7D%0A%09%7D%0A%0A
 %7D

extend JdbcConnectionTest