DiscreteInterval { public long size() { return max - min + 1; } DiscreteInterval(long min, long max); long getMin(); long getMax(); long size(); DiscreteInterval plus(DiscreteInterval other); DiscreteInterval negate(); DiscreteInterval minus(DiscreteInterval other); boolean contains(DiscreteInterval other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void sizeOfConstantIntervalIsOne() { DiscreteInterval i = new DiscreteInterval(1,1); assertEquals(1, i.size()); }
@Test public void sizeOfWiderIntervalReturnsDifferencePlusOne() { DiscreteInterval i = new DiscreteInterval(1,3); assertEquals(3, i.size()); }