/** 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()); } } }
/** Fail test wring bucket size */ @Test(expected = IllegalArgumentException.class) public void testAssertBadBucketSizeFail() { Bucket b = new Bucket(bucketSize - 1, new ArrayList<Block>()); b.fillDummies(blockSize); server.writeBucket(0, 0, b); }
/** Test the read bucket function */ @Test public void testReadBucket() { Bucket b = server.readBucket(50, 2); assertEquals(bucketSize, b.getBlocks().size()); }