public void testTwo() { List xs = Arrays.asList(new String[] {"a", "b"}); TrueIterator it = new TrueIterator(xs.iterator()); it.next(); try { it.remove(); fail("Remove should be unsupported."); } catch (UnsupportedOperationException e) { assertTrue(true); } }
public void testThree() { List xs = Arrays.asList(new String[] {}); TrueIterator it = new TrueIterator(xs.iterator()); try { assertFalse(it.hasNext()); it.next(); // it.next(); fail("Should not be a next."); } catch (NoSuchElementException e) { assertTrue(true); } List ys = Arrays.asList(new String[] {"a", "b"}); TrueIterator it2 = new TrueIterator(ys.iterator()); it2.next(); it2.next(); try { it2.next(); fail("Should not be a next."); } catch (NoSuchElementException e) { assertTrue(true); } }