### Question:
IntegerRange implements Range<Integer> { @Override public boolean contains(Object other) { if (other instanceof Integer) { int valueToFind = (Integer) other; for (int valueInRange : this) { if (valueInRange == valueToFind) { return true; } } } return false; } IntegerRange(Integer start, Integer end);  IntegerRange(Integer start, Integer end, Integer step); @Override boolean contains(Object other); @Override Integer getStart(); @Override Integer getEnd(); @Override Integer getStep(); @Override Iterator<Integer> iterator();  }### Answer:
@Test public void shouldReturnTrueIfTheRangeContainsTheSpecifiedInteger() throws Exception { Range<Integer> range = new IntegerRange(0, 10, 3); Boolean contained = range.contains(6); assertThat(contained, is(true)); }
@Test public void shouldReturnFalseIfTheRangeDoesNotContainTheSpecifiedInteger() throws Exception { Range<Integer> range = new IntegerRange(0, 10, 3); Boolean contained = range.contains(20); assertThat(contained, is(false)); }
@Test public void shouldReturnFalseIfTheSpecifiedIntegerIsBetweenStartAndEndButDoesNotLieOnAStepPoint() throws Exception { Range<Integer> range = new IntegerRange(0, 10, 3); Boolean contained = range.contains(4); assertThat(contained, is(false)); }
@Test public void shouldReturnFalseIfAnObjectOtherThanAnIntegerIsSupplied() throws Exception { Range<Integer> range = new IntegerRange(0, 10, 3); Boolean contained = range.contains("hello"); assertThat(contained, is(false)); }