Code example for Hashtable

Methods: put, toString

0
    /** 
     * java.util.Hashtable#toString() 
     */ 
    public void test_toString() { 
        // Test for method java.lang.String java.util.Hashtable.toString() 
        Hashtable h = new Hashtable();
        assertEquals("Incorrect toString for Empty table",
                "{}", h.toString());
 
        h.put("one", "1");
        h.put("two", h);
        h.put(h, "3");
        h.put(h, h);
        String result = h.toString();
        assertTrue("should contain self ref", result.indexOf("(this") > -1);
    } 
 
    /** 
     * java.util.Hashtable#values() 
     */ 
    public void test_values() {