private Stream<DynamicTest> findDynamicTests(String version) {

        // tests and their results are stored in TestJsonOperator.sql.stg in the resources
        final STGroup parent = StringTemplateSqlLocator.findStringTemplateGroup(TestJsonOperator.class);
        final Map<String, STGroup> children = Maps.uniqueIndex(parent.getImportedGroups(), STGroup::getName);

        final STGroup testGroup = children.get("postgres_" + version + ".sql");
        assertThat(testGroup).withFailMessage("Could not load test group for postgres %s", version).isNotNull();
        testGroup.load();

        // sanity check that all tests also have results. This also catches parse errors in the query templates
        Set<String> templateNames = testGroup.getTemplateNames();
        for (String name : templateNames) {
            if (name.endsWith("Result")) {
                assertThat(templateNames).contains(name.substring(0, name.length() - 6));
            } else {
                assertThat(templateNames).contains(name + "Result");
            }
        }

        // JUnit5 is awesome
        return templateNames.stream()
                .map(s -> s.substring(1))
                .filter(s -> !s.endsWith("Result"))
                .map(s -> DynamicTest.dynamicTest(s, () -> assertThat(
                        pgExtension.getSharedHandle()
                                .createQuery(s)
                                .mapTo(String.class)
                                .one())
                        .isEqualTo(getResult(testGroup, s))));
    }
Examples from <a href="https://www.postgresql.org/docs/current/static/functions-json.html">Postgres JSON Functions</a>. Escaping rules from <a
href="https://jdbc.postgresql.org/documentation/head/statement.html">Postgres Prepared Statements</a>.
postgres/src/test/java/org/jdbi/v3/postgres/TestJsonOperator.java