Package org.rendersnake.internal

Examples of org.rendersnake.internal.StackedMap


    private StackedMap map;
    private Map<String,Object> source;

    public void setUp() {
        this.map = new StackedMap();

        this.source = new HashMap<String,Object>();
        this.source.put("foo""bar");
        this.source.put("john", "doe");
    }
View Full Code Here


       assertTrue(map.isEmpty());
    }

    public void testCopyConstructor() {

        StackedMap map2 = new StackedMap(source);
        assertFalse(map2.isEmpty());
        assertEquals(2, map2.size());
        assertEquals("bar", map2.get("foo"));
        assertEquals("bar", map2.get("foo")); // make sure a <get> is not a <remove>
        assertEquals("doe", map2.get("john"));
    }
View Full Code Here

        assertEquals("doe", map2.get("john"));
    }

    public void testHashCode() {
        long emptyHashCode = this.map.hashCode();
        assertEquals("Expected consistent hash code for empty StackedHashMap.", emptyHashCode, new StackedMap().hashCode());

        this.map.put("foo", "bar");
        assertFalse("Expected hash code to change when adding a mapping.", map.hashCode() == emptyHashCode);

        this.map.clear();
View Full Code Here

        assertEquals("Expected consistent hash code for empty StackedHashMap.", emptyHashCode, map.hashCode());
    }

    public void testEquals() {
        map.putAll(this.source);
        StackedMap map2 = new StackedMap(this.source);
        assertEquals("Expected StackedMap(source) consistent hashCode", map.hashCode(), map.hashCode());
        assertTrue("Expected StackedMap(source) to create equals() instances (1/2).", map.equals(map2));
        assertTrue("Expected StackedMap(source) to create equals() instances (2/2).", map2.equals(map));
        assertFalse("Map is not a String", map.equals("othermap"));
    }
View Full Code Here

        assertEquals("bar", this.map.get("foo"));
    }

    public void testPutAll() {
        map.put("key0", "value0");
        StackedMap map2 = new StackedMap();
        map2.put("key1","value1");
        map.putAll(map2);
        assertTrue(map.containsKey("key0"));
        assertTrue(map.containsKey("key1"));
    }
View Full Code Here

TOP

Related Classes of org.rendersnake.internal.StackedMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.