public Set<T> leakedElements() {
            Set<T> result = new LinkedHashSet<>();
            for (T element : objectAdded.keySet()) {
                if (objectRemoved.containsKey(element)) { // present in both: ignore.
                    continue;
                }
                result.add(element); // present only in left
            }

            return result;
        }
A simple leak checker that tracks statement context and cleanable resource management.
testing/src/main/java/org/jdbi/v3/testing/junit5/internal/JdbiLeakChecker.java