public boolean isLastBlock(int blockNumber) {
    if (fileSize == 0) {
      return false;
    }

    throwIfInvalidBlockNumber(blockNumber);

    return blockNumber == (numBlocks - 1);
  }
@Test
  public void testArgChecks() throws Exception {
    // Should not throw.
    new BlockData(10, 5);
    new BlockData(5, 10);
    new BlockData(0, 10);

    // Verify it throws correctly.


    intercept(IllegalArgumentException.class, "'fileSize' must not be negative",
        () -> new BlockData(-1, 2));

    intercept(IllegalArgumentException.class,
        "'blockSize' must be a positive integer",
        () -> new BlockData(10, 0));

    intercept(IllegalArgumentException.class,
        "'blockSize' must be a positive integer",
        () -> new BlockData(10, -2));

    intercept(IllegalArgumentException.class,
        "'blockNumber' (-1) must be within the range [0, 3]",
        () -> new BlockData(10, 3).isLastBlock(
            -1));

    intercept(IllegalArgumentException.class,
        "'blockNumber' (11) must be within the range [0, 3]",
        () -> new BlockData(10, 3).isLastBlock(
            11));

  }