Code example for Field

Methods: getName, hashCode

0
            fail("NullPointerException expected but not thrown");
        } 
        assertTrue("NullPointerException expected but not thrown", thrown);
 
        // Test setting a static field; 
        f = x.getClass().getDeclaredField("intSField");
        f.setInt(null, Integer.MIN_VALUE);
        val = f.getInt(x);
        assertEquals("Returned incorrect int field value",
                Integer.MIN_VALUE, val);
    } 
 
    /** 
     * @tests java.lang.reflect.Field#setLong(java.lang.Object, long) 
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "setLong", 
        args = {java.lang.Object.class, long.class}
    )