### Question:
Ints implements Iterable<Integer> { public static Iterable<Integer> range(int start, int end) { return new Ints(start, end); } private  Ints(int start, int end); static Iterable<Integer> until(int end); static Iterable<Integer> range(int start, int end); @Override Iterator<Integer> iterator();  }### Answer:
@Test public void testRange() throws Exception { int counter = 4; for (int i : Ints.range(4,8)) { assertEquals(counter++, i); } assertEquals(9, counter); counter = -12; for (int i : Ints.range(-12,0)) { assertEquals(counter++, i); } assertEquals(1, counter); boolean did12=false; for (int i : Ints.range(12,12)) { assertEquals(12, i); did12=true; } assertTrue(did12); }
@Test(expected = IllegalArgumentException.class) public void testInvalidRange() throws Exception { Ints.range(12,8); }