mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/observation/TestViewObsMgrImpl.java
@Test
    public void testDownloadMedia() throws IOException
    {
        StreamedContent media = m_SUT.downloadMedia();
        //Verify that a default streamed content is returned if no observation is set.
        assertThat(media.getContentType(), is(nullValue()));
        assertThat(media.getStream(), is(nullValue()));
        
        final Observation obs = new Observation();
        obs.setDigitalMedia(new DigitalMedia(m_Data, "video/avi"));
        obs.setUuid(UUID.randomUUID());
        m_SUT.setObservation(obs);
        
        //Verify that the proper encoding type is set for the streamed content.
        media = m_SUT.downloadMedia();
        assertThat(media.getContentType(), is("video/avi"));
        
        //Verify that the bytes stored within the stream content are correct.
        int index = 0;
        int dataByte = 0;
        final InputStream dataStream = media.getStream();
        while ((dataByte = dataStream.read()) != -1)
        {
            assertThat((byte)dataByte, is(m_Data[index]));
            index++;
        }
    }
/**
     * Test that the downloadMedia method returns a streamed content object.
     * Verify the contents of the streamed content object.
     */
Test that the downloadMedia method returns a streamed content object.
Verify the contents of the streamed content object.
Test that the downloadMedia method returns a streamed content object . Verify the contents of the streamed content object .
@Test
    public void testDownloadMedia() throws IOException
    {
        StreamedContent media = m_SUT.downloadMedia();
        assertThat(media.getContentType(), is(nullValue()));
        assertThat(media.getStream(), is(nullValue()));
        final Observation obs = new Observation();
        obs.setDigitalMedia(new DigitalMedia(m_Data, "video/avi"));
        obs.setUuid(UUID.randomUUID());
        m_SUT.setObservation(obs);
        media = m_SUT.downloadMedia();
        assertThat(media.getContentType(), is("video/avi"));
        int index = 0;
        int dataByte = 0;
        final InputStream dataStream = media.getStream();
        while ((dataByte = dataStream.read()) != -1)
        {
            assertThat((byte)dataByte, is(m_Data[index]));
            index++;
        }
    }
@ Test public void testDownloadMedia ( ) throws IOException { StreamedContent media = m_SUT . downloadMedia ( ) ; assertThat ( media . getContentType ( ) , is ( nullValue ( ) ) ) ; assertThat ( media . getStream ( ) , is ( nullValue ( ) ) ) ; final Observation obs = new Observation ( ) ; obs . setDigitalMedia ( new DigitalMedia ( m_Data , "video/avi" ) ) ; obs . setUuid ( UUID . randomUUID ( ) ) ; m_SUT . setObservation ( obs ) ; media = m_SUT . downloadMedia ( ) ; assertThat ( media . getContentType ( ) , is ( "video/avi" ) ) ; int index = 0 ; int dataByte = 0 ; final InputStream dataStream = media . getStream ( ) ; while ( ( dataByte = dataStream . read ( ) ) != - 1 ) { assertThat ( ( byte ) dataByte , is ( m_Data [ index ] ) ) ; index ++ ; } }
Test that the downloadMedia method returns a streamed content object.
Test that the downloadMedia method returns a streamed content object .
//Verify that a default streamed content is returned if no observation is set. //Verify that the proper encoding type is set for the streamed content. //Verify that the bytes stored within the stream content are correct.