@Test
  public void testInvalidRanges() throws Exception {
    // negative indices
    testByteRangeCreationOffsetRange(-2, 1, false);
    testByteRangeCreationOffsetRange(5, -1, false);
    testByteRangeCreationOffsetRange(0, -1, false);
    testByteRangeCreationOffsetRange(-3, -2, false);
    testByteRangeCreationFromStartOffset(-1, false);
    testByteRangeCreationLastNBytes(-2, false);
    // start greater than end offset
    testByteRangeCreationOffsetRange(32, 4, false);
    testByteRangeCreationOffsetRange(1, 0, false);
    testByteRangeCreationOffsetRange(Long.MAX_VALUE, Long.MAX_VALUE - 1, false);
  }
Ensure that we cannot create invalid ranges.
@throws Exception
ambry-api/src/test/java/com/github/ambry/router/ByteRangeTest.java