### Question:
Range implements WritableComparable<Range> { public TRange toThrift() { return new TRange(start == null ? null : start.toThrift(), stop == null ? null : stop.toThrift(), startKeyInclusive, stopKeyInclusive, infiniteStartKey, infiniteStopKey); } Range();  Range(Key startKey, Key endKey);  Range(CharSequence row);  Range(Text row);  Range(Text startRow, Text endRow);  Range(CharSequence startRow, CharSequence endRow);  Range(Text startRow, boolean startRowInclusive, Text endRow, boolean endRowInclusive);  Range(CharSequence startRow, boolean startRowInclusive, CharSequence endRow,
      boolean endRowInclusive);  Range(Key startKey, boolean startKeyInclusive, Key endKey, boolean endKeyInclusive);  Range(Range range);  Range(Key start, Key stop, boolean startKeyInclusive, boolean stopKeyInclusive,
      boolean infiniteStartKey, boolean infiniteStopKey); protected  Range(Key start, boolean startKeyInclusive, boolean infiniteStartKey, Key stop,
      boolean stopKeyInclusive, boolean infiniteStopKey);  Range(TRange trange); Key getStartKey(); boolean beforeStartKey(Key key); Key getEndKey(); boolean afterEndKey(Key key); @Override int hashCode(); @Override boolean equals(Object o); boolean equals(Range otherRange); @Override int compareTo(Range o); boolean contains(Key key); static List<Range> mergeOverlapping(Collection<Range> ranges); Range clip(Range range); Range clip(Range range, boolean returnNullIfDisjoint); Range bound(Column min, Column max); @Override String toString(); @Override void readFields(DataInput in); @Override void write(DataOutput out); boolean isStartKeyInclusive(); boolean isEndKeyInclusive(); TRange toThrift(); boolean isInfiniteStartKey(); boolean isInfiniteStopKey(); static Range exact(Text row); static Range exact(Text row, Text cf); static Range exact(Text row, Text cf, Text cq); static Range exact(Text row, Text cf, Text cq, Text cv); static Range exact(Text row, Text cf, Text cq, Text cv, long ts); static Text followingPrefix(Text prefix); static Range prefix(Text rowPrefix); static Range prefix(Text row, Text cfPrefix); static Range prefix(Text row, Text cf, Text cqPrefix); static Range prefix(Text row, Text cf, Text cq, Text cvPrefix); static Range exact(CharSequence row); static Range exact(CharSequence row, CharSequence cf); static Range exact(CharSequence row, CharSequence cf, CharSequence cq); static Range exact(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cv); static Range exact(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cv,
      long ts); static Range prefix(CharSequence rowPrefix); static Range prefix(CharSequence row, CharSequence cfPrefix); static Range prefix(CharSequence row, CharSequence cf, CharSequence cqPrefix); static Range prefix(CharSequence row, CharSequence cf, CharSequence cq,
      CharSequence cvPrefix);  }### Answer:
@Test public void testThrift() { Range r = newRange("nuts", "soup"); TRange tr = r.toThrift(); Range r2 = new Range(tr); assertEquals(r, r2); }
@Test public void testThrift_Check() { Range r = new Range(new Key(new Text("soup")), true, false, new Key(new Text("nuts")), true, false); TRange tr = r.toThrift(); try { @SuppressWarnings("unused") Range r2 = new Range(tr); fail("Thrift constructor allowed invalid range"); } catch (IllegalArgumentException exc) { } }