### Question:
TracingDataSource implements DataSource { @Override @SuppressWarnings("unchecked") public <T> T unwrap(Class<T> iface) throws SQLException { if (iface.isInstance(this)) { return (T) this; } return delegate.unwrap(iface); } TracingDataSource(DataSource dataSource); static DataSource decorate(DataSource dataSource); @Override Connection getConnection(); @Override Connection getConnection(String username, String password); @Override @SuppressWarnings("unchecked") T unwrap(Class<T> iface); @Override boolean isWrapperFor(Class<?> iface); @Override PrintWriter getLogWriter(); @Override void setLogWriter(PrintWriter out); @Override void setLoginTimeout(int seconds); @Override int getLoginTimeout(); @Override Logger getParentLogger();  }### Answer:
@Test void testUnwrap() throws SQLException { Assertions.assertSame(dataSource, dataSource.unwrap(DataSource.class)); Assertions.assertSame(dataSource, dataSource.unwrap(TracingDataSource.class)); Assertions.assertSame(delegate, dataSource.unwrap(OtherWrapper.class)); Assertions.assertSame(delegate, dataSource.unwrap(ExtraInterface.class)); boolean exceptionThrown = false; try { dataSource.unwrap(Long.class); } catch (final SQLException e) { exceptionThrown = true; } Assertions.assertTrue(exceptionThrown); verify(delegate, never()).unwrap(DataSource.class); verify(delegate, never()).unwrap(TracingDataSource.class); verify(delegate).unwrap(OtherWrapper.class); verify(delegate).unwrap(ExtraInterface.class); verify(delegate).unwrap(Long.class); }