### Question:
SimpleDataSource implements DataSource { @SuppressWarnings("unchecked") @Override public <T> T unwrap(Class<T> iface) throws SQLException { if (iface == null) { throw new SQLException("iface must not be null"); } if (iface.isAssignableFrom(getClass())) { return (T) this; } throw new SQLException("cannot unwrap to " + iface.getName()); }  String getUrl(); void setUrl(String url); String getUser(); void setUser(String user); String getPassword(); void setPassword(String password); void addProperty(String key, String value); @Override int getLoginTimeout(); @Override void setLoginTimeout(int seconds); @Override Connection getConnection(); @Override Connection getConnection(String user, String password); @Override PrintWriter getLogWriter(); @Override void setLogWriter(PrintWriter out); @Override boolean isWrapperFor(Class<?> iface); @SuppressWarnings("unchecked") @Override T unwrap(Class<T> iface); Logger getParentLogger();  }### Answer:
@Test public void testUnwrap() throws Exception { DataSource dataSource = new SimpleDataSource(); assertNotNull(dataSource.unwrap(SimpleDataSource.class)); try { dataSource.unwrap(Runnable.class); fail(); } catch (SQLException ignored) { } }