@Test
  public void buildGetBlobOptionsTest() throws RestServiceException {
    // no range
    doBuildGetBlobOptionsTest(null, null, true, true);
    // valid ranges
    doBuildGetBlobOptionsTest("bytes=0-7", ByteRanges.fromOffsetRange(0, 7), true, false, true);
    doBuildGetBlobOptionsTest("bytes=234-56679090", ByteRanges.fromOffsetRange(234, 56679090), true, false, true);
    doBuildGetBlobOptionsTest("bytes=1-", ByteRanges.fromStartOffset(1), true, false, true);
    doBuildGetBlobOptionsTest("bytes=12345678-", ByteRanges.fromStartOffset(12345678), true, false, true);
    doBuildGetBlobOptionsTest("bytes=-8", ByteRanges.fromLastNBytes(8), true, false, true);
    doBuildGetBlobOptionsTest("bytes=-123456789", ByteRanges.fromLastNBytes(123456789), true, false, true);
    // bad ranges
    String[] badRanges =
        {"bytes=0-abcd", "bytes=0as23-44444444", "bytes=22-7777777777777777777777777777777777777777777", "bytes=22--53",
            "bytes=223-34", "bytes=-34ab", "bytes=--12", "bytes=-12-", "bytes=12ab-", "bytes=---", "btes=3-5",
            "bytes=345", "bytes=3.14-22", "bytes=3-6.2", "bytes=", "bytes=-", "bytes= -"};
    for (String badRange : badRanges) {
      doBuildGetBlobOptionsTest(badRange, null, false, false);
    }
  }
This tests the construction of {@link GetBlobOptions} objects with various range and sub-resource settings using
{@link RestUtils#buildGetBlobOptions}.
@throws RestServiceException
ambry-api/src/test/java/com/github/ambry/rest/RestUtilsTest.java