### Question:
DoubleRange implements Comparable<DoubleRange> { @Override public int compareTo(DoubleRange other) { int temp = low.compareTo(other.low); if (temp == 0) { temp = other.high.compareTo(high); } return temp; } DoubleRange();  DoubleRange(Double low, Double high); Double getHigh(); void setHigh(Double high); Double getLow(); void setLow(Double low); @Override int compareTo(DoubleRange other); boolean contains(double d); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void compareTo_shouldReturnPlus1IfThisLowIsGreaterThanOtherLow() { DoubleRange r1 = new DoubleRange(1.0, 2.0); DoubleRange r2 = new DoubleRange(0.0, 2.0); assertEquals(1, r1.compareTo(r2)); }
@Test public void compareTo_shouldReturnMinusOneIfThisLowIsLowerThanOtherLow() { DoubleRange r1 = new DoubleRange(1.0, 2.0); DoubleRange r2 = new DoubleRange(0.0, 2.0); assertEquals(-1, r2.compareTo(r1)); }
@Test public void compareTo_shouldReturnZeroIfBothLowsAndBothHighsAreEqual() { DoubleRange r1 = new DoubleRange(1.0, 2.0); DoubleRange r2 = new DoubleRange(1.0, 2.0); assertEquals(0, r1.compareTo(r2)); }
@Test public void compareTo_shouldReturnPlusOneIfBothLowsAreEqualButOtherHighIsGreaterThanThisHigh() { DoubleRange r1 = new DoubleRange(1.0, 1.0); DoubleRange r2 = new DoubleRange(1.0, 2.0); assertEquals(1, r1.compareTo(r2)); }
@Test public void compareTo_shouldReturnMinusOneIfBothLowsAreEqualButOtherHighIsLessThanThisHigh() { DoubleRange r1 = new DoubleRange(1.0, 2.0); DoubleRange r2 = new DoubleRange(1.0, 1.0); assertEquals(-1, r1.compareTo(r2)); }
@Test public void compareTo_shouldReturn1IfThisRangeIsWiderThanOtherRange() { DoubleRange r1 = new DoubleRange(0.0, 1.0); DoubleRange r2 = new DoubleRange(1.0, 3.0); assertEquals(1, r2.compareTo(r1)); }