@Test
    public void uniqueIndex() {
        Handle h = h2Extension.getSharedHandle();
        h.execute("create table \"user\" (id int, name varchar)");
        h.prepareBatch("insert into \"user\" (id, name) values (?, ?)")
                .add(1, "alice")
                .add(2, "bob")
                .add(3, "cathy")
                .add(4, "dilbert")
                .execute();

        Map<Integer, User> map = h.createQuery("select * from \"user\"")
                .setMapKeyColumn("id")
                .registerRowMapper(ConstructorMapper.factory(User.class))
                .collectInto(new GenericType<Map<Integer, User>>() {});

        assertThat(map).containsOnly(
                Tuple.of(1, new User(1, "alice")),
                Tuple.of(2, new User(2, "bob")),
                Tuple.of(3, new User(3, "cathy")),
                Tuple.of(4, new User(4, "dilbert")));
    }
from {@link org.jdbi.v3.core.mapper.MapEntryMapperTest}
vavr/src/test/java/org/jdbi/v3/vavr/TestVavrMapCollectorWithDB.java