public static void close(final Collection<DataSource> dataSources) {
        Collection<Exception> causes = new LinkedList<>();
        for (DataSource each : dataSources) {
            if (each instanceof AutoCloseable) {
                try {
                    ((AutoCloseable) each).close();
                    // CHECKSTYLE:OFF
                } catch (final Exception ex) {
                    // CHECKSTYLE:ON
                    causes.add(ex);
                }
            }
        }
        if (!causes.isEmpty()) {
            throwException(causes);
        }
    }
@Test
    void assertClose() throws Exception {
        DataSource dataSource0 = mock(DataSource.class, withSettings().extraInterfaces(AutoCloseable.class));
        DataSource dataSource1 = mock(DataSource.class, withSettings().extraInterfaces(AutoCloseable.class));
        doThrow(new SQLException("test")).when((AutoCloseable) dataSource1).close();
        DataSource dataSource2 = mock(DataSource.class, withSettings().extraInterfaces(AutoCloseable.class));
        assertThrows(SQLWrapperException.class, () -> DataSourcesCloser.close(Arrays.asList(dataSource0, dataSource1, dataSource2)));
        verify((AutoCloseable) dataSource0, times(1)).close();
        verify((AutoCloseable) dataSource1, times(1)).close();
        verify((AutoCloseable) dataSource2, times(1)).close();
    }