mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/mp/TestMissionExport.java
@Test
    public void testHandleMissionExport() throws MarshalException, IOException
    {
        String missionName = "TestMission";
        byte[] testArr = {100, 101, 102};
        MissionProgramTemplate testTemp = mock(MissionProgramTemplate.class);
        when(m_TemplateProgramManager.getTemplate(missionName)).thenReturn(testTemp);
        when(m_XMLMarshalService.createXmlByteArray(testTemp, true)).thenReturn(testArr);
        
        m_SUT.handleExportMission(missionName);
        //Verify that the exporting mission's name is correct.
        assertThat(m_SUT.getDownloadFile().getName(), is(missionName + ".xml"));
        
        int readNum;
        int index = 0;
        InputStream is = m_SUT.getDownloadFile().getStream();
        //Verify the information stored within the streamed content is correct.
        while ((readNum = is.read()) != -1)
        { 
            assertThat(testArr[index], is((byte)readNum));
            index++;
        }
    }
/**
     * Test the handleMissionExport method.
     * Verify that the information stored within the download file is correct after being set by the handleMissionExport
     * method.
     */
Test the handleMissionExport method.
Verify that the information stored within the download file is correct after being set by the handleMissionExport
method.
Test the handleMissionExport method . Verify that the information stored within the download file is correct after being set by the handleMissionExport method .
@Test
    public void testHandleMissionExport() throws MarshalException, IOException
    {
        String missionName = "TestMission";
        byte[] testArr = {100, 101, 102};
        MissionProgramTemplate testTemp = mock(MissionProgramTemplate.class);
        when(m_TemplateProgramManager.getTemplate(missionName)).thenReturn(testTemp);
        when(m_XMLMarshalService.createXmlByteArray(testTemp, true)).thenReturn(testArr);
        m_SUT.handleExportMission(missionName);
        assertThat(m_SUT.getDownloadFile().getName(), is(missionName + ".xml"));
        int readNum;
        int index = 0;
        InputStream is = m_SUT.getDownloadFile().getStream();
        while ((readNum = is.read()) != -1)
        { 
            assertThat(testArr[index], is((byte)readNum));
            index++;
        }
    }
@ Test public void testHandleMissionExport ( ) throws MarshalException , IOException { String missionName = "TestMission" ; byte [ ] testArr = { 100 , 101 , 102 } ; MissionProgramTemplate testTemp = mock ( MissionProgramTemplate . class ) ; when ( m_TemplateProgramManager . getTemplate ( missionName ) ) . thenReturn ( testTemp ) ; when ( m_XMLMarshalService . createXmlByteArray ( testTemp , true ) ) . thenReturn ( testArr ) ; m_SUT . handleExportMission ( missionName ) ; assertThat ( m_SUT . getDownloadFile ( ) . getName ( ) , is ( missionName + ".xml" ) ) ; int readNum ; int index = 0 ; InputStream is = m_SUT . getDownloadFile ( ) . getStream ( ) ; while ( ( readNum = is . read ( ) ) != - 1 ) { assertThat ( testArr [ index ] , is ( ( byte ) readNum ) ) ; index ++ ; } }
Test the handleMissionExport method.
Test the handleMissionExport method .
//Verify that the exporting mission's name is correct. //Verify the information stored within the streamed content is correct.