/** 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); }
/** 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()); } } }
/** Test the read bucket function */ @Test public void testReadBucket() { Bucket b = server.readBucket(50, 2); assertEquals(bucketSize, b.getBlocks().size()); }