1 60 package org.jaxen.util; 61 62 import java.util.Iterator ; 63 import java.util.NoSuchElementException ; 64 65 import junit.framework.TestCase; 66 67 public class SingleObjectIteratorTest extends TestCase { 68 69 private Iterator iterator = new SingleObjectIterator(new Object ()); 70 71 public void testNoInfiniteLoops() { 72 73 iterator.next(); 74 try { 75 iterator.next(); 76 fail("Iterated twice"); 77 } 78 catch (NoSuchElementException ex) { 79 } 80 81 } 82 83 84 public void testRemove() { 85 86 try { 87 iterator.remove(); 88 fail("Removed from iterator"); 89 } 90 catch (UnsupportedOperationException ex) { 91 } 92 93 } 94 95 } 96 | Popular Tags |