@Test
public void testCopyInSameDatabase() {

    ResolverMappingReplicator replicator = new ResolverMappingReplicator(primary, 10);
    FDBDatabase differentDB = new FDBDatabase(FDBDatabaseFactory.instance(), null);
    KeySpacePath path = keySpace.path("test-path").add("to").add("replica");
    try (FDBRecordContext context = differentDB.openContext()) {
        LocatableResolver resolverInDifferentDB = new ScopedInterningLayer(differentDB, path.toResolvedPath(context));
        replicator.copyTo(resolverInDifferentDB);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException ex) {
        assertThat(ex, hasMessageContaining("copy must be within same database"));
    }
}