### Question:
RangeHeader { public static Range<Long> parse(String rangeHeader, Long inclusiveUpperBound) { Assert.hasText(rangeHeader, "range header 不能为空"); Assert.isTrue(isValid(rangeHeader), "不是有效的 range header"); String trimedRange = rangeHeader.trim().substring("bytes=".length()); String[] ranges = trimedRange.split("-"); Assert.isTrue(ranges.length > 0, "至少包含一个片段"); long start = 0; long end = 0; if (ranges.length == 1) { start = NumberUtils.parseNumber(ranges[0], Long.class); end = inclusiveUpperBound; } else if (ranges.length == 2) { if (StringUtils.isBlank(ranges[0])) { start = 0L; } else { start = NumberUtils.parseNumber(ranges[0], Long.class); } end = NumberUtils.parseNumber(ranges[1], Long.class); } return Range.of(Bound.inclusive(start), Bound.inclusive(end)); }  static boolean isValid(String rangeHeader); static Range<Long> parse(String rangeHeader, Long inclusiveUpperBound);  }### Answer:
@Test public void parse_range_header_is_null() { Assertions.assertThrows(IllegalArgumentException.class, () -> RangeHeader.parse(null, 10L)); }
@Test public void parse_range_header_is_blank() { Assertions.assertThrows(IllegalArgumentException.class, () -> RangeHeader.parse(" ", 10L)); }
@Test public void parse_range_header_not_contains_range() { Assertions.assertThrows(IllegalArgumentException.class, () -> RangeHeader.parse("xxx=-1 ", 10L)); }
@Test public void parse_range_header_not_contains_strikethrough() { Assertions.assertThrows(IllegalArgumentException.class, () -> RangeHeader.parse("xxx=1 ", 10L)); }
@Test public void parse_not_has_lower_or_upper() { Assertions.assertThrows(IllegalArgumentException.class, () -> RangeHeader.parse("bytes=-", 10L)); }
@Test public void parse_not_number() { Assertions.assertThrows(IllegalArgumentException.class, () -> RangeHeader.parse("bytes=a-b", 10L)); }
@Test public void parse_starts_with_strikethrough() { Range<Long> range = RangeHeader.parse("bytes=-1", 10L); assertThat(range.getLowerBound().getValue().get()).isEqualTo(0); assertThat(range.getUpperBound().getValue().get()).isEqualTo(1); }
@Test public void parse_ends_with_strikethrough() { Range<Long> range = RangeHeader.parse("bytes=1-", 10L); assertThat(range.getLowerBound().getValue().get()).isEqualTo(1); assertThat(range.getUpperBound().getValue().get()).isEqualTo(10); }
@Test public void parse_has_lower_and_upper() { Range<Long> range = RangeHeader.parse("bytes=1-2", 10L); assertThat(range.getLowerBound().getValue().get()).isEqualTo(1); assertThat(range.getUpperBound().getValue().get()).isEqualTo(2); }