mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestFactoryObjectConfigModifierViewImpl.java
@Test
    public void testSetConfigPropertiesAsyncWithNoPid()
    {
        when(m_BaseModel.getPid()).thenReturn("");
        UnmodifiableConfigMetatypeModel model = mockUnmodifiableConfigMetatypeModel();
        when(m_ConfigWrapper.getConfigurationDefaultsByFactoryPidAsync(
                CONTROLLER_ID, FACTORY_CONF_NAME)).thenReturn(null, model);
        
        List<ModifiablePropertyModel> list = m_SUT.getProperties();
        assertThat(list.size(), is(0));
        
        list = m_SUT.getProperties();
        
        //once because call to getProperties and then once for the setConfig method
        verify(m_ConfigWrapper, times(2))
            .getConfigurationDefaultsByFactoryPidAsync(CONTROLLER_ID, FACTORY_CONF_NAME);
        
        assertThat(list.size(), is(2));
        
        ModifiablePropertyModel mod1 = list.get(0);
        assertThat(mod1.getKey(), is(m_Property1.getKey()));
        assertThat(mod1.getName(), is(m_Property1.getName()));
        assertThat(mod1.getDescription(), is(m_Property1.getDescription()));
        assertThat(mod1.getValue(), is(m_Property1.getValue()));
        
        ModifiablePropertyModel mod2 = list.get(1);
        assertThat(mod2.getKey(), is(m_Property2.getKey()));
        assertThat(mod2.getName(), is(m_Property2.getName()));
        assertThat(mod2.getDescription(), is(m_Property2.getDescription()));
        assertThat(mod2.getValue(), is(m_Property2.getValue()));
    }
/**
     * Verify properties can be properly set when factory object doesn't have a pid.
     */
Verify properties can be properly set when factory object doesn't have a pid.
Verify properties can be properly set when factory object doesn ' t have a pid .
@Test
    public void testSetConfigPropertiesAsyncWithNoPid()
    {
        when(m_BaseModel.getPid()).thenReturn("");
        UnmodifiableConfigMetatypeModel model = mockUnmodifiableConfigMetatypeModel();
        when(m_ConfigWrapper.getConfigurationDefaultsByFactoryPidAsync(
                CONTROLLER_ID, FACTORY_CONF_NAME)).thenReturn(null, model);
        List<ModifiablePropertyModel> list = m_SUT.getProperties();
        assertThat(list.size(), is(0));
        list = m_SUT.getProperties();
        verify(m_ConfigWrapper, times(2))
            .getConfigurationDefaultsByFactoryPidAsync(CONTROLLER_ID, FACTORY_CONF_NAME);
        assertThat(list.size(), is(2));
        ModifiablePropertyModel mod1 = list.get(0);
        assertThat(mod1.getKey(), is(m_Property1.getKey()));
        assertThat(mod1.getName(), is(m_Property1.getName()));
        assertThat(mod1.getDescription(), is(m_Property1.getDescription()));
        assertThat(mod1.getValue(), is(m_Property1.getValue()));
        ModifiablePropertyModel mod2 = list.get(1);
        assertThat(mod2.getKey(), is(m_Property2.getKey()));
        assertThat(mod2.getName(), is(m_Property2.getName()));
        assertThat(mod2.getDescription(), is(m_Property2.getDescription()));
        assertThat(mod2.getValue(), is(m_Property2.getValue()));
    }
@ Test public void testSetConfigPropertiesAsyncWithNoPid ( ) { when ( m_BaseModel . getPid ( ) ) . thenReturn ( "" ) ; UnmodifiableConfigMetatypeModel model = mockUnmodifiableConfigMetatypeModel ( ) ; when ( m_ConfigWrapper . getConfigurationDefaultsByFactoryPidAsync ( CONTROLLER_ID , FACTORY_CONF_NAME ) ) . thenReturn ( null , model ) ; List < ModifiablePropertyModel > list = m_SUT . getProperties ( ) ; assertThat ( list . size ( ) , is ( 0 ) ) ; list = m_SUT . getProperties ( ) ; verify ( m_ConfigWrapper , times ( 2 ) ) . getConfigurationDefaultsByFactoryPidAsync ( CONTROLLER_ID , FACTORY_CONF_NAME ) ; assertThat ( list . size ( ) , is ( 2 ) ) ; ModifiablePropertyModel mod1 = list . get ( 0 ) ; assertThat ( mod1 . getKey ( ) , is ( m_Property1 . getKey ( ) ) ) ; assertThat ( mod1 . getName ( ) , is ( m_Property1 . getName ( ) ) ) ; assertThat ( mod1 . getDescription ( ) , is ( m_Property1 . getDescription ( ) ) ) ; assertThat ( mod1 . getValue ( ) , is ( m_Property1 . getValue ( ) ) ) ; ModifiablePropertyModel mod2 = list . get ( 1 ) ; assertThat ( mod2 . getKey ( ) , is ( m_Property2 . getKey ( ) ) ) ; assertThat ( mod2 . getName ( ) , is ( m_Property2 . getName ( ) ) ) ; assertThat ( mod2 . getDescription ( ) , is ( m_Property2 . getDescription ( ) ) ) ; assertThat ( mod2 . getValue ( ) , is ( m_Property2 . getValue ( ) ) ) ; }
Verify properties can be properly set when factory object doesn't have a pid.
Verify properties can be properly set when factory object doesn ' t have a pid .
//once because call to getProperties and then once for the setConfig method