Code example for AbstractMap.SimpleImmutableEntry

Methods: getValue

0
        entry = new AbstractMap.SimpleImmutableEntry(null,null); 
        assertNull(entry.getKey()); 
    } 
     
    public void test_SimpleImmutableEntry_getValue() throws Exception { 
        Entry entry = new AbstractMap.SimpleImmutableEntry<Integer, String>(1,"test"); 
        assertEquals("test",entry.getValue()); 
        entry = new AbstractMap.SimpleImmutableEntry(null,null); 
        assertNull(entry.getValue()); 
    } 
     
    public void test_SimpleImmutableEntry_setValue() throws Exception { 
        Entry entry = new AbstractMap.SimpleImmutableEntry<Integer, String>(1,"test"); 
        assertEquals("test",entry.getValue()); 
        try{ 
            entry.setValue("Another String"); 
            fail("should throw UnsupportedOperationException"); 
        } catch (UnsupportedOperationException e){ 
            // expected 
        } 
        assertEquals("test",entry.getValue());