1 19 20 package org.netbeans.modules.java.source.util; 21 22 import java.util.ArrayList ; 23 import java.util.Iterator ; 24 import java.util.List ; 25 import java.util.NoSuchElementException ; 26 import java.util.Random ; 27 import junit.framework.*; 28 import org.netbeans.modules.java.source.TestUtil; 29 30 34 public class IteratorToIterableTest extends TestCase { 35 36 public IteratorToIterableTest(String testName) { 37 super(testName); 38 } 39 40 protected void setUp() throws Exception { 41 } 42 43 protected void tearDown() throws Exception { 44 } 45 46 public static Test suite() { 47 TestSuite suite = new TestSuite(IteratorToIterableTest.class); 48 return suite; 49 } 50 51 53 public void testValues() { 54 55 List <Integer > gl = IteratorTest.createSequentialList( 100 ); 56 57 String diff = TestUtil.collectionDiff( gl, Iterators.toIterable( gl.iterator() ) ); 58 assertEquals( "Diff should be empty", "", diff ); 59 60 } 61 62 public void testEmptyValues() { 63 64 List <Integer > gl = new ArrayList <Integer >(); 65 66 String diff = TestUtil.collectionDiff( gl, Iterators.toIterable( gl.iterator() ) ); 67 assertEquals( "Diff should be empty", "", diff ); 68 69 } 70 71 public void testInvalidParametrs() { 72 73 try { 74 Iterators.toIterable( null ); 75 fail( "IllegalArgumentException should have been thrown, but was not."); 76 } 77 catch( IllegalArgumentException e ) { 78 } 80 81 } 82 83 } 84 | Popular Tags |