int numBlocksNeeded = calculateTheNumberOfBlocksNeeded(data);
int numBlocksNeeded = calculateTheNumberOfBlocksNeeded(data);
int numBlocksNeeded = blockDisk.calculateTheNumberOfBlocksNeeded(data);
int numBlocksNeeded = blockDisk.calculateTheNumberOfBlocksNeeded( data );
/** * Verify that it says we need two blocks if the total size will fit. * <p> * @throws Exception */ public void testCalculateBlocksNeededDouble() throws Exception { // SETUP String fileName = "testCalculateBlocksNeededDouble"; File file = new File( rafDir, fileName + ".data" ); file.delete(); BlockDisk disk = new BlockDisk( file, new StandardSerializer() ); // DO WORK int result = disk.calculateTheNumberOfBlocksNeeded( new byte[disk.getBlockSizeBytes() * 2 - ( 2 * BlockDisk.HEADER_SIZE_BYTES )] ); // Verify assertEquals( "Wrong number of blocks", 2, result ); }
/** * Verify that it says we need two blocks if the total size will fit. * <p> * @throws Exception */ public void testCalculateBlocksNeededDouble() throws Exception { // SETUP String fileName = "testCalculateBlocksNeededDouble"; File file = new File( rafDir, fileName + ".data" ); file.delete(); BlockDisk disk = new BlockDisk( file, new StandardSerializer() ); // DO WORK int result = disk.calculateTheNumberOfBlocksNeeded( new byte[disk.getBlockSizeBytes() * 2 - ( 2 * BlockDisk.HEADER_SIZE_BYTES )] ); // Verify assertEquals( "Wrong number of blocks", 2, result ); }