ds.setDriverClassName("org.h2.Driver");
ds.setUrl("jdbc:h2:mem:test_mem");
ds.setAccessToUnderlyingConnectionAllowed(true);
Connection conn = ds.getConnection();
UnWrapper uw = DataSourceFinder.getUnWrapper(conn);
assertNotNull(uw);
assertTrue(uw.canUnwrap(conn));
Connection unwrapped = uw.unwrap(conn);
assertNotNull(unwrapped);
assertTrue(unwrapped instanceof org.h2.jdbc.JdbcConnection);
Statement st = conn.createStatement();
uw = DataSourceFinder.getUnWrapper(st);
assertNotNull(uw);
assertTrue(uw.canUnwrap(st));
Statement uwst = uw.unwrap(st);
assertNotNull(uwst);
assertTrue(uwst instanceof org.h2.jdbc.JdbcStatement);
st.close();
PreparedStatement ps = conn.prepareStatement("select curtime()");
uw = DataSourceFinder.getUnWrapper(ps);
assertNotNull(uw);
assertTrue(uw.canUnwrap(ps));
PreparedStatement uwps = (PreparedStatement) uw.unwrap(ps);
assertNotNull(uwps);
assertTrue(uwps instanceof org.h2.jdbc.JdbcPreparedStatement);
ps.close();