@Test
public void testExclusiveLock() {

    // version is cached for 30 seconds by default
    database.setResolverStateRefreshTimeMillis(100);
    globalScope.exclusiveLock().join();
    assertLocked(database, globalScope);
    try {
        globalScope.exclusiveLock().join();
        fail("lock already enabled, should fail");
    } catch (CompletionException ex) {
        assertThat("we get the correct cause", ex.getCause(), allOf(
                instanceOf(LocatableResolverLockedException.class),
                hasMessageContaining("resolver must be unlocked to get exclusive lock")
        ));
    }
}