### Question:
IdRange { public static List<IdRange> parseRangeSequence(String idRangeSequence) { StringTokenizer tokenizer = new StringTokenizer(idRangeSequence, ","); List<IdRange> ranges = new ArrayList<>(); while (tokenizer.hasMoreTokens()) { ranges.add(parseRange(tokenizer.nextToken())); } return ranges; } IdRange(long singleVal);  IdRange(long lowVal, long highVal); long getLowVal(); long getHighVal(); boolean includes(long uid); static List<IdRange> parseRangeSequence(String idRangeSequence); static IdRange parseRange(String range); static IdRange[] convertUidsToIdRangeArray(List<Long> uids); static String uidsToRangeString(List<Long> uids); static String idRangeToString(IdRange idRange); static String idRangesToString(IdRange[] idRanges); static boolean containsUid(IdRange[] idRanges, long uid); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final Pattern SEQUENCE; static final long VALUE_WILDCARD; }### Answer:
@Test public void testParseRangeSequence() { String sequenceSetText = "1"; assertThat(IdRange.SEQUENCE.matcher(sequenceSetText).matches()).isTrue(); List<IdRange> sequenceSet = IdRange.parseRangeSequence(sequenceSetText); assertThat(sequenceSet).hasSize(1); assertThat(sequenceSet.get(0)).isEqualTo(new IdRange(1)); sequenceSetText = "*"; assertThat(IdRange.SEQUENCE.matcher(sequenceSetText).matches()).isTrue(); sequenceSet = IdRange.parseRangeSequence(sequenceSetText); assertThat(sequenceSet).hasSize(1); assertThat(sequenceSet.get(0)).isEqualTo(new IdRange(VALUE_WILDCARD)); sequenceSetText = "5:2"; assertThat(IdRange.SEQUENCE.matcher(sequenceSetText).matches()).isTrue(); sequenceSet = IdRange.parseRangeSequence(sequenceSetText); assertThat(sequenceSet).hasSize(1); assertThat(new IdRange(2,5)).isEqualTo(sequenceSet.get(0)); sequenceSetText = "1,3"; assertThat(IdRange.SEQUENCE.matcher(sequenceSetText).matches()).isTrue(); sequenceSet = IdRange.parseRangeSequence(sequenceSetText); assertThat(sequenceSet).hasSize(2); assertThat(sequenceSet.get(0)).isEqualTo(new IdRange(1)); assertThat(sequenceSet.get(1)).isEqualTo(new IdRange(3)); sequenceSetText = "*:4,8"; assertThat(IdRange.SEQUENCE.matcher(sequenceSetText).matches()).isTrue(); sequenceSet = IdRange.parseRangeSequence(sequenceSetText); assertThat(sequenceSet).hasSize(2); assertThat(new IdRange(4, VALUE_WILDCARD)).isEqualTo(sequenceSet.get(0)); assertThat(sequenceSet.get(1)).isEqualTo(new IdRange(8)); sequenceSetText ="1,4:*"; assertThat(IdRange.SEQUENCE.matcher(sequenceSetText).matches()).isTrue(); sequenceSet = IdRange.parseRangeSequence(sequenceSetText); assertThat(sequenceSet).hasSize(2); assertThat(sequenceSet.get(0)).isEqualTo(new IdRange(1)); assertThat(new IdRange(4, VALUE_WILDCARD)).isEqualTo(sequenceSet.get(1)); sequenceSetText ="1,2:4,8"; assertThat(IdRange.SEQUENCE.matcher(sequenceSetText).matches()).isTrue(); sequenceSet = IdRange.parseRangeSequence(sequenceSetText); assertThat(sequenceSet).hasSize(3); assertThat(sequenceSet.get(0)).isEqualTo(new IdRange(1)); assertThat(new IdRange(2, 4)).isEqualTo(sequenceSet.get(1)); assertThat(sequenceSet.get(2)).isEqualTo(new IdRange(8)); }