FileDocCategorySizeDatePackage
Support_MapTest2.javaAPI DocAndroid 1.5 API2363Wed May 06 22:41:06 BST 2009tests.support

Support_MapTest2

public class Support_MapTest2 extends TestCase

Fields Summary
Map
map
Constructors Summary
public Support_MapTest2(Map m)

        super();
        map = m;
        if (!map.isEmpty()) {
            fail("Map must be empty");
        }
    
Methods Summary
public voidrunTest()

        try {
            map.put("one", "1");
            assertEquals("size should be one", 1, map.size());
            map.clear();
            assertEquals("size should be zero", 0, map.size());
            assertTrue("Should not have entries", !map.entrySet().iterator()
                    .hasNext());
            assertTrue("Should not have keys", !map.keySet().iterator()
                    .hasNext());
            assertTrue("Should not have values", !map.values().iterator()
                    .hasNext());
        } catch (UnsupportedOperationException e) {
        }

        try {
            map.put("one", "1");
            assertEquals("size should be one", 1, map.size());
            map.remove("one");
            assertEquals("size should be zero", 0, map.size());
            assertTrue("Should not have entries", !map.entrySet().iterator()
                    .hasNext());
            assertTrue("Should not have keys", !map.keySet().iterator()
                    .hasNext());
            assertTrue("Should not have values", !map.values().iterator()
                    .hasNext());
        } catch (UnsupportedOperationException e) {
        }