mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestSystemMetatypeMgrImpl.java
@SuppressWarnings("unchecked")
    @Test
    public void testGetConfigInformation() throws SecurityException, NoSuchFieldException, IllegalArgumentException, 
        IllegalAccessException
    {
        //Mock bundle manager information.
        BundleModel testBundle = mock(BundleModel.class);
        List<BundleModel> bundleList = new ArrayList<BundleModel>();
        bundleList.add(testBundle);
        when(testBundle.getBundleId()).thenReturn(BUNDLEID);
        
        assertThat(m_SUT.getConfigInformationAsync(CONTROLLERID, "some PID"), is(nullValue()));
        
        //Added controller and meta type model to map for meta type information.
        Field configMap = m_SUT.getClass().getDeclaredField("m_MetatypeListConfigs");
        configMap.setAccessible(true);
        Map<Integer, List<MetaTypeModel>> map = (Map<Integer, List<MetaTypeModel>>)configMap.get(m_SUT);
        MetaTypeModel model = new MetaTypeModel("some PID", BUNDLEID);
        List<MetaTypeModel> modelList = new ArrayList<MetaTypeModel>();
        modelList.add(model);
        map.put(CONTROLLERID, modelList);
        
        assertThat(m_SUT.getConfigInformationAsync(CONTROLLERID, "some PID"), is(model));
        
        //Verify message sent to retrieve meta info.
        ArgumentCaptor<GetMetaTypeInfoRequestData> requestCaptor = 
                ArgumentCaptor.forClass(GetMetaTypeInfoRequestData.class);
        verify(m_MessageFactory).createMetaTypeMessage(eq(MetaTypeMessageType.GetMetaTypeInfoRequest), 
                requestCaptor.capture());
        verify(m_MessageWrapper, times(2)).queue(eq(CONTROLLERID), 
                Mockito.any(ResponseHandler.class));
    }
/**
     * Test the get config information method. 
     * Verify that null is returned if the meta type information cannot be found for the PID. 
     * Verify that the meta type information is returned for the specified PID.
     */
Test the get config information method.
Verify that null is returned if the meta type information cannot be found for the PID.
Verify that the meta type information is returned for the specified PID.
Test the get config information method . Verify that null is returned if the meta type information cannot be found for the PID . Verify that the meta type information is returned for the specified PID .
@SuppressWarnings("unchecked")
    @Test
    public void testGetConfigInformation() throws SecurityException, NoSuchFieldException, IllegalArgumentException, 
        IllegalAccessException
    {
        BundleModel testBundle = mock(BundleModel.class);
        List<BundleModel> bundleList = new ArrayList<BundleModel>();
        bundleList.add(testBundle);
        when(testBundle.getBundleId()).thenReturn(BUNDLEID);
        assertThat(m_SUT.getConfigInformationAsync(CONTROLLERID, "some PID"), is(nullValue()));
        Field configMap = m_SUT.getClass().getDeclaredField("m_MetatypeListConfigs");
        configMap.setAccessible(true);
        Map<Integer, List<MetaTypeModel>> map = (Map<Integer, List<MetaTypeModel>>)configMap.get(m_SUT);
        MetaTypeModel model = new MetaTypeModel("some PID", BUNDLEID);
        List<MetaTypeModel> modelList = new ArrayList<MetaTypeModel>();
        modelList.add(model);
        map.put(CONTROLLERID, modelList);
        assertThat(m_SUT.getConfigInformationAsync(CONTROLLERID, "some PID"), is(model));
        ArgumentCaptor<GetMetaTypeInfoRequestData> requestCaptor = 
                ArgumentCaptor.forClass(GetMetaTypeInfoRequestData.class);
        verify(m_MessageFactory).createMetaTypeMessage(eq(MetaTypeMessageType.GetMetaTypeInfoRequest), 
                requestCaptor.capture());
        verify(m_MessageWrapper, times(2)).queue(eq(CONTROLLERID), 
                Mockito.any(ResponseHandler.class));
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testGetConfigInformation ( ) throws SecurityException , NoSuchFieldException , IllegalArgumentException , IllegalAccessException { BundleModel testBundle = mock ( BundleModel . class ) ; List < BundleModel > bundleList = new ArrayList < BundleModel > ( ) ; bundleList . add ( testBundle ) ; when ( testBundle . getBundleId ( ) ) . thenReturn ( BUNDLEID ) ; assertThat ( m_SUT . getConfigInformationAsync ( CONTROLLERID , "some PID" ) , is ( nullValue ( ) ) ) ; Field configMap = m_SUT . getClass ( ) . getDeclaredField ( "m_MetatypeListConfigs" ) ; configMap . setAccessible ( true ) ; Map < Integer , List < MetaTypeModel > > map = ( Map < Integer , List < MetaTypeModel > > ) configMap . get ( m_SUT ) ; MetaTypeModel model = new MetaTypeModel ( "some PID" , BUNDLEID ) ; List < MetaTypeModel > modelList = new ArrayList < MetaTypeModel > ( ) ; modelList . add ( model ) ; map . put ( CONTROLLERID , modelList ) ; assertThat ( m_SUT . getConfigInformationAsync ( CONTROLLERID , "some PID" ) , is ( model ) ) ; ArgumentCaptor < GetMetaTypeInfoRequestData > requestCaptor = ArgumentCaptor . forClass ( GetMetaTypeInfoRequestData . class ) ; verify ( m_MessageFactory ) . createMetaTypeMessage ( eq ( MetaTypeMessageType . GetMetaTypeInfoRequest ) , requestCaptor . capture ( ) ) ; verify ( m_MessageWrapper , times ( 2 ) ) . queue ( eq ( CONTROLLERID ) , Mockito . any ( ResponseHandler . class ) ) ; }
Test the get config information method.
Test the get config information method .
//Mock bundle manager information. //Added controller and meta type model to map for meta type information. //Verify message sent to retrieve meta info.