1 29 package org.jruby.test; 30 31 import junit.framework.TestCase; 32 33 import org.jruby.util.collections.IdentitySet; 34 35 public class TestIdentitySet extends TestCase { 36 37 public TestIdentitySet(String name) { 38 super(name); 39 } 40 41 public void testStoring() { 42 IdentitySet set = new IdentitySet(); 43 String s1 = "hello"; 44 String s2 = new String (s1); 45 String s3 = "some other string"; 46 47 set.add(s1); 48 assertTrue(set.contains(s1)); 49 assertTrue(! set.contains(s2)); 50 assertTrue(! set.contains(s3)); 51 52 set.add(s2); 53 assertTrue(set.contains(s1)); 54 assertTrue(set.contains(s2)); 55 assertTrue(! set.contains(s3)); 56 57 set.remove(s2); 58 assertTrue(set.contains(s1)); 59 assertTrue(! set.contains(s2)); 60 assertTrue(! set.contains(s3)); 61 } 62 } 63 | Popular Tags |