Code example for AbstractMap.SimpleImmutableEntry

Methods: getValue, setValue

0
        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());
        try{ 
            entry.setValue(null);
            fail("should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e){
            // expected 
        } 
    }