private void testByteRangeCreationFromStartOffset(long startOffset, boolean expectSuccess) throws Exception {
    List<LongFunction<ByteRange>> factories = Arrays.asList(ByteRange::fromStartOffset, ByteRanges::fromStartOffset);
    for (LongFunction<ByteRange> factory : factories) {
      if (expectSuccess) {
        ByteRange byteRange = factory.apply(startOffset);
        assertEquals("Wrong range type", ByteRange.ByteRangeType.FROM_START_OFFSET, byteRange.getType());
        assertEquals("Wrong startOffset", startOffset, byteRange.getStartOffset());
        TestUtils.assertException(UnsupportedOperationException.class, byteRange::getEndOffset, null);
        TestUtils.assertException(UnsupportedOperationException.class, byteRange::getLastNBytes, null);
        TestUtils.assertException(UnsupportedOperationException.class, byteRange::getRangeSize, null);
      } else {
        TestUtils.assertException(IllegalArgumentException.class, () -> factory.apply(startOffset), null);
      }
    }
  }
Test that {@link ByteRange} works as expected for byte ranges with only a defined start offset.
@param startOffset the (inclusive) start byte offset to test.
@param expectSuccess {@code true} if the {@link ByteRange} creation should succeed.
@throws Exception
ambry-api/src/test/java/com/github/ambry/router/ByteRangeTest.java