mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestControllerConfigurationMgrImpl.java
@Test
    public void testGetConfigModelByPid()
    {
        createConfigModelInformation();
        
        //Verify that retrieving a non-existent configuration model returns null.
        assertThat(m_SUT.getConfigModelByPidAsync(25, "non-existent pid"), is(nullValue()));
        
        //Retrieve the config display model and verify contents.
        ModifiableConfigMetatypeModel displayModel = m_SUT.getConfigModelByPidAsync(25, "some PID");
        assertThat(displayModel, is(notNullValue()));
        assertThat(displayModel.getPid(), is("some PID"));
        assertThat(displayModel.getProperties().size(), is(2));
        
        List<String> defaultValues = new ArrayList<String>();
        defaultValues.add("default");
        
        //Verify the first property in the first display model.
        ModifiablePropertyModel displayProp = displayModel.getProperties().get(0);
        assertThat(displayProp.getKey(), is("key1"));
        assertThat(displayProp.getName(), is("key1"));
        assertThat(displayProp.getType(), is((Object)String.class));
        assertThat(displayProp.getValue(), is((Object)"value1"));
        assertThat(displayProp.getDescription(), is("descrip"));
        assertThat(displayProp.getDefaultValues(), is(defaultValues));
        
        //Verify the second property in the first display model.
        displayProp = displayModel.getProperties().get(1);
        assertThat(displayProp.getKey(), is("key2"));
        assertThat(displayProp.getName(), is("key2"));
        assertThat(displayProp.getType(), is((Object)String.class));
        assertThat(displayProp.getValue(), is((Object)"value2"));
        assertThat(displayProp.getDescription(), is("descrip"));
        assertThat(displayProp.getDefaultValues(), is(defaultValues));
        
        //Verify that if the model is requested again that it equals the first model that was returned.
        assertThat(m_SUT.getConfigModelByPidAsync(25, "some PID"), is(displayModel));
        //Data for the model should only be retrieved from the config wrapper once. Verify that it is only called once.
        verify(m_ConfigWrapper).getConfigurationByPidAsync(25, "some PID");
    }
/**
     * Test the get config model by PID method.
     * Verify that null is returned if the model does not exist.
     * Verify the correct information is returned for the specified model that does exist.
     */
Test the get config model by PID method.
Verify that null is returned if the model does not exist.
Verify the correct information is returned for the specified model that does exist.
Test the get config model by PID method . Verify that null is returned if the model does not exist . Verify the correct information is returned for the specified model that does exist .
@Test
    public void testGetConfigModelByPid()
    {
        createConfigModelInformation();
        assertThat(m_SUT.getConfigModelByPidAsync(25, "non-existent pid"), is(nullValue()));
        ModifiableConfigMetatypeModel displayModel = m_SUT.getConfigModelByPidAsync(25, "some PID");
        assertThat(displayModel, is(notNullValue()));
        assertThat(displayModel.getPid(), is("some PID"));
        assertThat(displayModel.getProperties().size(), is(2));
        List<String> defaultValues = new ArrayList<String>();
        defaultValues.add("default");
        ModifiablePropertyModel displayProp = displayModel.getProperties().get(0);
        assertThat(displayProp.getKey(), is("key1"));
        assertThat(displayProp.getName(), is("key1"));
        assertThat(displayProp.getType(), is((Object)String.class));
        assertThat(displayProp.getValue(), is((Object)"value1"));
        assertThat(displayProp.getDescription(), is("descrip"));
        assertThat(displayProp.getDefaultValues(), is(defaultValues));
        displayProp = displayModel.getProperties().get(1);
        assertThat(displayProp.getKey(), is("key2"));
        assertThat(displayProp.getName(), is("key2"));
        assertThat(displayProp.getType(), is((Object)String.class));
        assertThat(displayProp.getValue(), is((Object)"value2"));
        assertThat(displayProp.getDescription(), is("descrip"));
        assertThat(displayProp.getDefaultValues(), is(defaultValues));
        assertThat(m_SUT.getConfigModelByPidAsync(25, "some PID"), is(displayModel));
        verify(m_ConfigWrapper).getConfigurationByPidAsync(25, "some PID");
    }
@ Test public void testGetConfigModelByPid ( ) { createConfigModelInformation ( ) ; assertThat ( m_SUT . getConfigModelByPidAsync ( 25 , "non-existent pid" ) , is ( nullValue ( ) ) ) ; ModifiableConfigMetatypeModel displayModel = m_SUT . getConfigModelByPidAsync ( 25 , "some PID" ) ; assertThat ( displayModel , is ( notNullValue ( ) ) ) ; assertThat ( displayModel . getPid ( ) , is ( "some PID" ) ) ; assertThat ( displayModel . getProperties ( ) . size ( ) , is ( 2 ) ) ; List < String > defaultValues = new ArrayList < String > ( ) ; defaultValues . add ( "default" ) ; ModifiablePropertyModel displayProp = displayModel . getProperties ( ) . get ( 0 ) ; assertThat ( displayProp . getKey ( ) , is ( "key1" ) ) ; assertThat ( displayProp . getName ( ) , is ( "key1" ) ) ; assertThat ( displayProp . getType ( ) , is ( ( Object ) String . class ) ) ; assertThat ( displayProp . getValue ( ) , is ( ( Object ) "value1" ) ) ; assertThat ( displayProp . getDescription ( ) , is ( "descrip" ) ) ; assertThat ( displayProp . getDefaultValues ( ) , is ( defaultValues ) ) ; displayProp = displayModel . getProperties ( ) . get ( 1 ) ; assertThat ( displayProp . getKey ( ) , is ( "key2" ) ) ; assertThat ( displayProp . getName ( ) , is ( "key2" ) ) ; assertThat ( displayProp . getType ( ) , is ( ( Object ) String . class ) ) ; assertThat ( displayProp . getValue ( ) , is ( ( Object ) "value2" ) ) ; assertThat ( displayProp . getDescription ( ) , is ( "descrip" ) ) ; assertThat ( displayProp . getDefaultValues ( ) , is ( defaultValues ) ) ; assertThat ( m_SUT . getConfigModelByPidAsync ( 25 , "some PID" ) , is ( displayModel ) ) ; verify ( m_ConfigWrapper ) . getConfigurationByPidAsync ( 25 , "some PID" ) ; }
Test the get config model by PID method.
Test the get config model by PID method .
//Verify that retrieving a non-existent configuration model returns null. //Retrieve the config display model and verify contents. //Verify the first property in the first display model. //Verify the second property in the first display model. //Verify that if the model is requested again that it equals the first model that was returned. //Data for the model should only be retrieved from the config wrapper once. Verify that it is only called once.