@Test
    void getOrCreateId_emptyDB() {

        final RefStreamDefinition refStreamDefinition = new RefStreamDefinition(
                UUID.randomUUID().toString(),
                UUID.randomUUID().toString(),
                123456L);
        final MapDefinition mapDefinition = new MapDefinition(refStreamDefinition,
                "MyMapName");

        final UID uid1 = lmdbEnv.getWithWriteTxn(writeTxn -> {
            UID uid = mapDefinitionUIDStore.getOrCreateUid(
                    writeTxn,
                    mapDefinition,
                    mapDefinitionUIDStore.getUidPooledByteBuffer());

            assertThat(uid).isNotNull();

            long id = UID.UNSIGNED_BYTES.get(uid.getBackingBuffer());

            // empty store so should get back the first id value of 0
            assertThat(id).isEqualTo(0);
            return uid;
        });

        assertThat(mapDefinitionUIDStore.getEntryCount()).isEqualTo(1);

        mapUidForwardDb.logRawDatabaseContents();
        mapUidReverseDb.logRawDatabaseContents();

        // now try again with the same mapDefinition, which should give the same UID
        final UID uid2 = lmdbEnv.getWithWriteTxn(writeTxn -> {
            UID uid = mapDefinitionUIDStore.getOrCreateUid(
                    writeTxn,
                    mapDefinition,
                    mapDefinitionUIDStore.getUidPooledByteBuffer());

            assertThat(uid).isNotNull();

            long id = UID.UNSIGNED_BYTES.get(uid.getBackingBuffer());

            // empty store so should get back the first id value of 0
            assertThat(id).isEqualTo(0);
            return uid;
        });

        assertThat(uid1.getBackingBuffer())
                .isEqualByComparingTo(uid2.getBackingBuffer());
    }
Noddy test to verify how LMDB copes with different buffer capacities
stroom-pipeline/src/test/java/stroom/pipeline/refdata/store/offheapstore/TestMapDefinitionUIDStore.java