/** Writes and reads from different levels */
 @Test
 public void testWriteReadLevels() {
   for (int i = 0; i < server.getTreeHeight(); i++) {
     server.writeBucket(i, i, makeBucket(i));
   }
   for (int i = 0; i < server.getTreeHeight(); i++) {
     Bucket bucket = server.readBucket(i, i);
     for (Block block : bucket.getBlocks()) {
       assertEquals(i, block.getId());
     }
   }
 }
 /** Fail test bad block size */
 @Test(expected = IllegalArgumentException.class)
 public void testAssertBadBlockSizeFail() {
   Bucket b = new Bucket(bucketSize, new ArrayList<Block>());
   for (int i = 0; i < b.getBlocks().size(); ++i) {
     b.getBlocks().set(i, Block.create(0, new BitMatrix(blockSize), true));
   }
   server.writeBucket(0, 0, b);
 }
 private Bucket makeBucket(int globalIndex) {
   List<Block> blocks = new ArrayList<Block>();
   for (int blockInBucket = 0; blockInBucket < server.getBucketSize(); blockInBucket++) {
     blocks.add(Block.create(globalIndex, new BitMatrix(blockSize), true));
   }
   Bucket bucket = new Bucket(server.getBucketSize(), blocks);
   return bucket;
 }