@Test
void testUpdateMetadata() {

    byte[] oldMetadata = Tuple.from("old-metadata").pack();
    byte[] newMetadata = Tuple.from("new-metadata").pack();
    StringInterningLayer interningLayer;
    ResolverResult initial;
    ResolverResult updated;
    final String key = "update-metadata";
    try (FDBRecordContext context = database.openContext()) {
        interningLayer = new StringInterningLayer(testSubspace);
        initial = interningLayer.create(context, key, oldMetadata).join();
        interningLayer.updateMetadata(context, key, newMetadata).join();
        updated = interningLayer.read(context, key).join().orElseThrow(() -> new AssertionError("should be present"));
        assertThat("we see the new metadata", updated, is(new ResolverResult(initial.getValue(), newMetadata)));
        context.commit();
    }
    try (FDBRecordContext context = database.openContext()) {
        ResolverResult newTransactionRead = interningLayer.read(context, key).join().orElseThrow(() -> new AssertionError("should be present"));
        assertThat("we see the committed metadata in a new transaction", newTransactionRead, is(updated));
    }
}