mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/TestAbstractFactoryObject.java
@SuppressWarnings("unchecked")
    @Test
    public void testSetProperties_UpdateFails() throws IOException, IllegalArgumentException, 
        IllegalStateException, ConfigurationException, FactoryException
    {
        Configuration config = ConfigurationAdminMocker.getConfigByPid(OBJ_PID);    
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("key1", "value1");
        doThrow(new IOException()).when(config).update(Mockito.any(Dictionary.class));
        try
        {
            m_SUT.setProperties(properties);
            fail("Expecting exception");
        }
        catch (FactoryException e)
        {
            //expecting the exception
        }

        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
    }
/**
     * Verify set properties fails if update fails.
     */
Verify set properties fails if update fails.
Verify set properties fails if update fails .
@SuppressWarnings("unchecked")
    @Test
    public void testSetProperties_UpdateFails() throws IOException, IllegalArgumentException, 
        IllegalStateException, ConfigurationException, FactoryException
    {
        Configuration config = ConfigurationAdminMocker.getConfigByPid(OBJ_PID);    
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("key1", "value1");
        doThrow(new IOException()).when(config).update(Mockito.any(Dictionary.class));
        try
        {
            m_SUT.setProperties(properties);
            fail("Expecting exception");
        }
        catch (FactoryException e)
        {
        }
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testSetProperties_UpdateFails ( ) throws IOException , IllegalArgumentException , IllegalStateException , ConfigurationException , FactoryException { Configuration config = ConfigurationAdminMocker . getConfigByPid ( OBJ_PID ) ; Map < String , Object > properties = new Hashtable < String , Object > ( ) ; properties . put ( "key1" , "value1" ) ; doThrow ( new IOException ( ) ) . when ( config ) . update ( Mockito . any ( Dictionary . class ) ) ; try { m_SUT . setProperties ( properties ) ; fail ( "Expecting exception" ) ; } catch ( FactoryException e ) { } verify ( m_WakeLock ) . activate ( ) ; verify ( m_WakeLock ) . cancel ( ) ; }
Verify set properties fails if update fails.
Verify set properties fails if update fails .
//expecting the exception