public Collection<SQLException> closeConnections(final boolean forceRollback) {
        Collection<SQLException> result = new LinkedList<>();
        synchronized (cachedConnections) {
            resetSessionVariablesIfNecessary(cachedConnections.values(), result);
            for (Connection each : cachedConnections.values()) {
                try {
                    if (forceRollback && connectionSession.getTransactionStatus().isInTransaction()) {
                        each.rollback();
                    }
                    each.close();
                } catch (final SQLException ex) {
                    result.add(ex);
                }
            }
            cachedConnections.clear();
        }
        if (!forceRollback) {
            connectionPostProcessors.clear();
        }
        return result;
    }
@Test
    void assertCloseConnectionsCorrectlyWhenForceRollbackAndInTransaction() throws SQLException {
        connectionSession.getTransactionStatus().setInTransaction(true);
        Connection connection = prepareCachedConnections();
        databaseConnectionManager.closeConnections(true);
        verify(connection).rollback();
    }