@Test
public void testSetMapping() {

    Long value;
    try (FDBRecordContext context = database.openContext()) {
        value = globalScope.resolve(context.getTimer(), "an-existing-mapping").join();
    }
    try (FDBRecordContext context = database.openContext()) {
        globalScope.setMapping(context, "a-new-mapping", 99L).join();
        globalScope.setMapping(context, "an-existing-mapping", value).join();
        // need to commit before we will be able to see the mapping with resolve
        // since resolve always uses a separate transaction
        context.commit();
    }
    try (FDBRecordContext context = database.openContext()) {
        assertThat("we can see the new mapping", globalScope.resolve(context.getTimer(), "a-new-mapping").join(), is(99L));
        assertThat("we can see the new reverse mapping", globalScope.reverseLookup(null, 99L).join(), is("a-new-mapping"));
        assertThat("we can see the existing mapping", globalScope.resolve(context.getTimer(), "an-existing-mapping").join(), is(value));
        assertThat("we can see the existing reverse mapping", globalScope.reverseLookup(null, value).join(), is("an-existing-mapping"));
    }
}