public static DatabaseType getStorageType(final DataSource dataSource) {
        try (Connection connection = dataSource.getConnection()) {
            return DatabaseTypeFactory.get(connection.getMetaData().getURL());
        } catch (final SQLFeatureNotSupportedException sqlFeatureNotSupportedException) {
            if (dataSource instanceof CatalogSwitchableDataSource) {
                return DatabaseTypeFactory.get(((CatalogSwitchableDataSource) dataSource).getUrl());
            }
            if (dataSource.getClass().getName().equals(new HikariDataSourcePoolMetaData().getType())) {
                HikariDataSourcePoolFieldMetaData dataSourcePoolFieldMetaData = new HikariDataSourcePoolFieldMetaData();
                String jdbcUrlFieldName = ReflectionUtils.<String>getFieldValue(dataSource, dataSourcePoolFieldMetaData.getJdbcUrlFieldName())
                        .orElseThrow(() -> new SQLWrapperException(sqlFeatureNotSupportedException));
                return DatabaseTypeFactory.get(jdbcUrlFieldName);
            }
            throw new SQLWrapperException(sqlFeatureNotSupportedException);
        } catch (final SQLException ex) {
            throw new SQLWrapperException(ex);
        }
    }
@Test
    void assertGetStorageType() throws SQLException {
        assertThat(DatabaseTypeEngine.getStorageType(mockDataSource(TypedSPILoader.getService(DatabaseType.class, "H2"))).getType(), is("H2"));
    }