mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/TestAbstractFactoryObject.java
@Test
    public void testSetProperties_NullConfiguration() throws Exception
    {
        Configuration config = ConfigurationAdminMocker.getConfigByPid(OBJ_PID);
        
        when(m_ConfigAdmin.listConfigurations(anyString())).thenReturn(null);
        when(m_Registry.createConfiguration(
                Mockito.any(UUID.class), anyString(), Mockito.any(FactoryObjectInternal.class))).thenReturn(config);
        
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("test-prop", "test-value");
        m_SUT.setProperties(properties);
        
        verify(m_Registry).createConfiguration(OBJ_UUID, FACTORY_PID, m_SUT);
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
    }
/**
     * Verify that set properties will create a new configuration if existing PID results in null config object.
     */
Verify that set properties will create a new configuration if existing PID results in null config object.
Verify that set properties will create a new configuration if existing PID results in null config object .
@Test
    public void testSetProperties_NullConfiguration() throws Exception
    {
        Configuration config = ConfigurationAdminMocker.getConfigByPid(OBJ_PID);
        when(m_ConfigAdmin.listConfigurations(anyString())).thenReturn(null);
        when(m_Registry.createConfiguration(
                Mockito.any(UUID.class), anyString(), Mockito.any(FactoryObjectInternal.class))).thenReturn(config);
        Map<String, Object> properties = new Hashtable<String, Object>();
        properties.put("test-prop", "test-value");
        m_SUT.setProperties(properties);
        verify(m_Registry).createConfiguration(OBJ_UUID, FACTORY_PID, m_SUT);
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
    }
@ Test public void testSetProperties_NullConfiguration ( ) throws Exception { Configuration config = ConfigurationAdminMocker . getConfigByPid ( OBJ_PID ) ; when ( m_ConfigAdmin . listConfigurations ( anyString ( ) ) ) . thenReturn ( null ) ; when ( m_Registry . createConfiguration ( Mockito . any ( UUID . class ) , anyString ( ) , Mockito . any ( FactoryObjectInternal . class ) ) ) . thenReturn ( config ) ; Map < String , Object > properties = new Hashtable < String , Object > ( ) ; properties . put ( "test-prop" , "test-value" ) ; m_SUT . setProperties ( properties ) ; verify ( m_Registry ) . createConfiguration ( OBJ_UUID , FACTORY_PID , m_SUT ) ; verify ( m_WakeLock ) . activate ( ) ; verify ( m_WakeLock ) . cancel ( ) ; }
Verify that set properties will create a new configuration if existing PID results in null config object.
Verify that set properties will create a new configuration if existing PID results in null config object .