@Test
void testCreate() {

    try (FDBRecordContext context = database.openContext()) {
        StringInterningLayer interningLayer = new StringInterningLayer(testSubspace);
        String toIntern = "some-string";
        byte[] metadata = Tuple.from("some-metadata").pack();
        ResolverResult interned = interningLayer.create(context, toIntern, metadata).join();
        assertArrayEquals(interned.getMetadata(), metadata, "we see the metadata with the interned value");
        Optional<ResolverResult> maybeRead = interningLayer.read(context, toIntern).join();
        assertIsPresentWithValue("we read the value", maybeRead, interned);
        Optional<String> maybeReverseRead = interningLayer.readReverse(context, interned.getValue()).join();
        assertIsPresentWithValue("the reverse lookup works", maybeReverseRead, toIntern);
        try {
            interningLayer.create(context, toIntern, null).join();
            fail("should throw exception");
        } catch (CompletionException ex) {
            assertThat(ex.getCause(), is(instanceOf(RecordCoreException.class)));
            assertThat(ex.getCause().getMessage(), containsString("value already exists in interning layer"));
            RecordCoreException cause = (RecordCoreException) ex.getCause();
            assertThat("exception log info has the key", cause.getLogInfo(), hasEntry("value", toIntern));
        }
    }
}