mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestCreateFactoryConfiguration.java
@Test
    public void testCreateConfiguration()
    {    
        //test set up
        UnmodifiableConfigMetatypeModel model = mock(UnmodifiableConfigMetatypeModel.class);
        //create dummy models
        ConfigPropModelImpl configModel1 = ModelFactory.createPropModel("imma key", "imma value");
        ConfigPropModelImpl configModel2 = ModelFactory.createPropModel("key", "value");
        //add models to list
        List<UnmodifiablePropertyModel> propModels = new ArrayList<UnmodifiablePropertyModel>();
        propModels.add(configModel1);
        propModels.add(configModel2);
        when(model.getProperties()).thenReturn(propModels);
        
        m_SUT.setPropertiesList(model, "immaPid", 123);
        
        m_SUT.createConfiguration();
        
        ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class);
        verify(m_MessageFactory).createConfigAdminMessage(eq(ConfigAdminMessageType.
                CreateFactoryConfigurationRequest), captor.capture());
        verify(m_MessageWrapper).queue(eq(123), (ResponseHandler)eq(null));
        
        CreateFactoryConfigurationRequestData data = (CreateFactoryConfigurationRequestData)captor.getValue();
        assertThat(data.getFactoryPid(), is("immaPid"));
        assertThat(data.getFactoryPropertyCount(), is(2));
        assertThat(data.getFactoryProperty(0).getKey(), is("imma key"));
        assertThat(data.getFactoryProperty(1).getKey(), is("key"));
    }
/**
     * Verify request to create factory configuration is sent.
     * Verify contents of request match data contained in properties.
     */
Verify request to create factory configuration is sent.
Verify contents of request match data contained in properties.
Verify request to create factory configuration is sent . Verify contents of request match data contained in properties .
@Test
    public void testCreateConfiguration()
    {    
        UnmodifiableConfigMetatypeModel model = mock(UnmodifiableConfigMetatypeModel.class);
        ConfigPropModelImpl configModel1 = ModelFactory.createPropModel("imma key", "imma value");
        ConfigPropModelImpl configModel2 = ModelFactory.createPropModel("key", "value");
        List<UnmodifiablePropertyModel> propModels = new ArrayList<UnmodifiablePropertyModel>();
        propModels.add(configModel1);
        propModels.add(configModel2);
        when(model.getProperties()).thenReturn(propModels);
        m_SUT.setPropertiesList(model, "immaPid", 123);
        m_SUT.createConfiguration();
        ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class);
        verify(m_MessageFactory).createConfigAdminMessage(eq(ConfigAdminMessageType.
                CreateFactoryConfigurationRequest), captor.capture());
        verify(m_MessageWrapper).queue(eq(123), (ResponseHandler)eq(null));
        CreateFactoryConfigurationRequestData data = (CreateFactoryConfigurationRequestData)captor.getValue();
        assertThat(data.getFactoryPid(), is("immaPid"));
        assertThat(data.getFactoryPropertyCount(), is(2));
        assertThat(data.getFactoryProperty(0).getKey(), is("imma key"));
        assertThat(data.getFactoryProperty(1).getKey(), is("key"));
    }
@ Test public void testCreateConfiguration ( ) { UnmodifiableConfigMetatypeModel model = mock ( UnmodifiableConfigMetatypeModel . class ) ; ConfigPropModelImpl configModel1 = ModelFactory . createPropModel ( "imma key" , "imma value" ) ; ConfigPropModelImpl configModel2 = ModelFactory . createPropModel ( "key" , "value" ) ; List < UnmodifiablePropertyModel > propModels = new ArrayList < UnmodifiablePropertyModel > ( ) ; propModels . add ( configModel1 ) ; propModels . add ( configModel2 ) ; when ( model . getProperties ( ) ) . thenReturn ( propModels ) ; m_SUT . setPropertiesList ( model , "immaPid" , 123 ) ; m_SUT . createConfiguration ( ) ; ArgumentCaptor < Message > captor = ArgumentCaptor . forClass ( Message . class ) ; verify ( m_MessageFactory ) . createConfigAdminMessage ( eq ( ConfigAdminMessageType . CreateFactoryConfigurationRequest ) , captor . capture ( ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 123 ) , ( ResponseHandler ) eq ( null ) ) ; CreateFactoryConfigurationRequestData data = ( CreateFactoryConfigurationRequestData ) captor . getValue ( ) ; assertThat ( data . getFactoryPid ( ) , is ( "immaPid" ) ) ; assertThat ( data . getFactoryPropertyCount ( ) , is ( 2 ) ) ; assertThat ( data . getFactoryProperty ( 0 ) . getKey ( ) , is ( "imma key" ) ) ; assertThat ( data . getFactoryProperty ( 1 ) . getKey ( ) , is ( "key" ) ) ; }
Verify request to create factory configuration is sent.
Verify request to create factory configuration is sent .
//test set up //create dummy models //add models to list