@Test(expected = IOException.class)
public void testWrongKey() throws Exception {

    byte[] keyBytes = randomBytes(16);
    File file = new File(folder.getRoot(), UUID.randomUUID().toString());
    {
        Database db = Database.build(file, keyBytes, null, null);
        boolean uniqueKeys = true;
        Btree btree = new Btree(db, uniqueKeys);
        simplePut(btree, 100);
        simpleRead(btree, 100);
        Assert.assertTrue(btree.getDb().getPageStore().debugIsIdle().or(true));
        db.close();
    }
    keyBytes = randomBytes(16);
    {
        Database db = Database.build(file, keyBytes, null, null);
        boolean uniqueKeys = true;
        // Should throw
        Btree btree = new Btree(db, uniqueKeys);
        simpleRead(btree, 100);
        Assert.assertTrue(btree.getDb().getPageStore().debugIsIdle().or(true));
        db.close();
    }
}