1 6 package com.hp.hpl.jena.util.test; 7 8 import java.util.*; 9 10 import junit.framework.TestSuite; 11 12 import com.hp.hpl.jena.rdf.model.test.ModelTestBase; 13 import com.hp.hpl.jena.util.CollectionFactory; 14 15 19 public class TestCollectionFactory extends ModelTestBase 20 { 21 public TestCollectionFactory( String name ) 22 { super( name ); } 23 24 public static TestSuite suite() 25 { return new TestSuite( TestCollectionFactory.class ); } 26 27 public void testHashMapExists() 28 { 29 Map map = CollectionFactory.createHashedMap(); 30 assertTrue( map instanceof Map ); 31 } 32 33 public void testHashMapSized() 34 { 35 Map map = CollectionFactory.createHashedMap( 42 ); 36 assertTrue( map instanceof Map ); 37 } 38 39 public void testHashMapCopy() 40 { 41 Map map = new HashMap(); 42 map.put( "here", "Bristol" ); 43 map.put( "there", "Oxford" ); 44 Map copy = CollectionFactory.createHashedMap( map ); 45 assertEquals( map, copy ); 46 } 47 48 public void testHashSetExists() 49 { 50 Set set = CollectionFactory.createHashedSet(); 51 assertTrue( set instanceof Set ); 52 } 53 54 public void testHashSetCopy() 55 { 56 Set s = new HashSet(); 57 s.add( "jelly" ); 58 s.add( "concrete" ); 59 Set copy = CollectionFactory.createHashedSet( s ); 60 assertEquals( s, copy ); 61 } 62 } 63 64 65 | Popular Tags |