### Question:
DoubleRange implements Comparable<DoubleRange> { @Override public String toString() { StringBuilder ret = new StringBuilder(); if (low != null && low != Double.NEGATIVE_INFINITY) { ret.append(">"); if (closedLow) { ret.append("="); } ret.append(" ").append(Format.format(low)); if (high != null && high != Double.NEGATIVE_INFINITY) { ret.append(" and "); } } if (high != null && high != Double.POSITIVE_INFINITY) { ret.append("<"); if (closedHigh) { ret.append("="); } ret.append(" ").append(Format.format(high)); } return ret.toString(); } 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 toString_shouldPrintTheRangeIfHighAndLowAreNotNullAndNotInfinite() { DoubleRange r1 = new DoubleRange(1.0, 1.0); assertEquals(">= 1.0 and < 1.0", r1.toString()); }
@Test public void toString_shouldPrintEmptyLowIfLowIsInfinite() { DoubleRange r1 = new DoubleRange(Double.NEGATIVE_INFINITY, 1.0); assertEquals("< 1.0", r1.toString()); }
@Test public void toString_shouldPrintEmptyStringIfLowAndHighAreInfinite() { DoubleRange r1 = new DoubleRange(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); assertEquals("", r1.toString()); }
@Test public void toString_shouldPrintEmptyStringIfLowAndHighAreNull() { DoubleRange r = new DoubleRange(null, null); assertEquals("", r.toString()); }
@Test public void toString_shouldPrintEmptyLowIfLowIsNull() { DoubleRange r = new DoubleRange(null, 1.0); assertEquals("< 1.0", r.toString()); }