FirmwareImage implements Chunk.Chunkable { public int blockCount() { return (int) Math.ceil((double) data().length / FW_BLOCK_SIZE); } FirmwareImage(byte[] rawData, String filename); byte[] data(); String name(); int sizeBytes(); long version(); @Override byte[] getChunkableData(); int crc(); int crcShadow(); int intVersion(); int length(); byte[] uniqueID(); byte[] reserved(); byte[] metadata(); int blockCount(); byte[] block(int index);  }
@Test public void testBlockCount() throws ImageParsingException { FirmwareImage image1 = new FirmwareImage(rawImageData_valid, ""); FirmwareImage image2 = new FirmwareImage(rawImageData_invalid, ""); assertThat(image1.blockCount()).isEqualTo(1); assertThat(image2.blockCount()).isEqualTo(3); }