mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/utils/TestReflectionsUtil.java
@Test
    public void testRetrieveUnsetMethod() throws IllegalArgumentException, IllegalAccessException, 
        InvocationTargetException
    {
        Method methodDNE = ReflectionsUtil.retrieveUnsetMethod(m_Obj, "DoesNotExist");
        assertThat(methodDNE, is(nullValue()));
        
        Method unsetMethod = ReflectionsUtil.retrieveUnsetMethod(m_Obj, "TestInteger");
        assertThat(unsetMethod, is(notNullValue()));
        
        unsetMethod.invoke(m_Obj, new Object[] {});
        try
        {
            m_Obj.getTestInteger();
            fail("Null pointer exception should be thrown since get method returns a primitive integer.");
        }
        catch (NullPointerException ex)
        {
            //expected exception
        }
    }
/**
     * Verify that the unset method will return null if the method does not exist and a correct method name returns
     * a valid method.
     */
Verify that the unset method will return null if the method does not exist and a correct method name returns
a valid method.
Verify that the unset method will return null if the method does not exist and a correct method name returns a valid method .
@Test
    public void testRetrieveUnsetMethod() throws IllegalArgumentException, IllegalAccessException, 
        InvocationTargetException
    {
        Method methodDNE = ReflectionsUtil.retrieveUnsetMethod(m_Obj, "DoesNotExist");
        assertThat(methodDNE, is(nullValue()));
        Method unsetMethod = ReflectionsUtil.retrieveUnsetMethod(m_Obj, "TestInteger");
        assertThat(unsetMethod, is(notNullValue()));
        unsetMethod.invoke(m_Obj, new Object[] {});
        try
        {
            m_Obj.getTestInteger();
            fail("Null pointer exception should be thrown since get method returns a primitive integer.");
        }
        catch (NullPointerException ex)
        {
        }
    }
@ Test public void testRetrieveUnsetMethod ( ) throws IllegalArgumentException , IllegalAccessException , InvocationTargetException { Method methodDNE = ReflectionsUtil . retrieveUnsetMethod ( m_Obj , "DoesNotExist" ) ; assertThat ( methodDNE , is ( nullValue ( ) ) ) ; Method unsetMethod = ReflectionsUtil . retrieveUnsetMethod ( m_Obj , "TestInteger" ) ; assertThat ( unsetMethod , is ( notNullValue ( ) ) ) ; unsetMethod . invoke ( m_Obj , new Object [ ] { } ) ; try { m_Obj . getTestInteger ( ) ; fail ( "Null pointer exception should be thrown since get method returns a primitive integer." ) ; } catch ( NullPointerException ex ) { } }
Verify that the unset method will return null if the method does not exist and a correct method name returns
 a valid method.
Verify that the unset method will return null if the method does not exist and a correct method name returns a valid method .
//expected exception