mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/observation/TestViewObsMgrImpl.java
@Test
    public void testGetMedia() throws IOException
    {
        //Test observation with an image that has a resolution greater than the max is allowed to be displayed. Should
        //be scaled appropriately.
        Observation obs = buildTestObsHighRes();
        m_SUT.setObservation(obs);
        
        //Verify that the image is scaled correctly since it's height and width are greater than the max allowed.
        assertThat(m_SUT.getHeight(), is(391));
        assertThat(m_SUT.getWidth(), is(470));
        
        //Verify that the proper encoding type is set for the streamed content.
        final StreamedContent media = m_SUT.getMedia();
        assertThat(media.getContentType(), is(m_Encoding));
        
        //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 getMedia method returns a streamed content object.
     * Verify the contents of the streamed content are correct.
     */
Test that the getMedia method returns a streamed content object.
Verify the contents of the streamed content are correct.
Test that the getMedia method returns a streamed content object . Verify the contents of the streamed content are correct .
@Test
    public void testGetMedia() throws IOException
    {
        Observation obs = buildTestObsHighRes();
        m_SUT.setObservation(obs);
        assertThat(m_SUT.getHeight(), is(391));
        assertThat(m_SUT.getWidth(), is(470));
        final StreamedContent media = m_SUT.getMedia();
        assertThat(media.getContentType(), is(m_Encoding));
        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 testGetMedia ( ) throws IOException { Observation obs = buildTestObsHighRes ( ) ; m_SUT . setObservation ( obs ) ; assertThat ( m_SUT . getHeight ( ) , is ( 391 ) ) ; assertThat ( m_SUT . getWidth ( ) , is ( 470 ) ) ; final StreamedContent media = m_SUT . getMedia ( ) ; assertThat ( media . getContentType ( ) , is ( m_Encoding ) ) ; 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 getMedia method returns a streamed content object.
Test that the getMedia method returns a streamed content object .
//Test observation with an image that has a resolution greater than the max is allowed to be displayed. Should //be scaled appropriately. //Verify that the image is scaled correctly since it's height and width are greater than the max allowed. //Verify that the proper encoding type is set for the streamed content. //Verify that the bytes stored within the stream content are correct.