mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/observation/TestObservationImageService.java
@SuppressWarnings("unchecked")
    @Test
    public void testTryGetMiniObservationImage()
    {
        m_SUT = new ObservationImageService();
        
        GuiObservation obs = mock(GuiObservation.class);
        
        List<RelatedObservationIdentity> refIds = new ArrayList<>();
        refIds.add(new RelatedObservationIdentity(true, ObservationSubTypeEnum.DETECTION));
        refIds.add(new RelatedObservationIdentity(true, ObservationSubTypeEnum.AUDIO_METADATA));
        refIds.add(new RelatedObservationIdentity(true, null));
        
        when(obs.getRelatedObservationModels()).thenReturn(refIds);
        
        assertThat(m_SUT.tryGetMiniObservationImage(obs, -1), is("thoseIcons/observations/mini-icons/unknown.png"));
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 0), is("thoseIcons/observations/mini-icons/detection.png"));
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 1), 
                is("thoseIcons/observations/mini-icons/audio_metadata.png"));
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 2), is("thoseIcons/observations/mini-icons/unknown.png"));
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 3), is("thoseIcons/observations/mini-icons/unknown.png"));
        
        when(obs.getRelatedObservationModels()).thenReturn(new ArrayList<RelatedObservationIdentity>());

        assertThat(m_SUT.tryGetMiniObservationImage(obs, 1), is("thoseIcons/observations/mini-icons/unknown.png"));
        
        assertThat(m_SUT.tryGetMiniObservationImage(null, -1), is("thoseIcons/observations/mini-icons/unknown.png"));

        List<RelatedObservationIdentity> list = mock(ArrayList.class);
        when(list.size()).thenReturn(1);
        when(obs.getRelatedObservationModels()).thenReturn(list);
        
        when(list.get(0)).thenReturn(null);
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 0), is("thoseIcons/observations/mini-icons/unknown.png"));
    }
/**
     * Verify that the correct mini observation image path is returned for the given inputs.
     */
Verify that the correct mini observation image path is returned for the given inputs.
Verify that the correct mini observation image path is returned for the given inputs .
@SuppressWarnings("unchecked")
    @Test
    public void testTryGetMiniObservationImage()
    {
        m_SUT = new ObservationImageService();
        GuiObservation obs = mock(GuiObservation.class);
        List<RelatedObservationIdentity> refIds = new ArrayList<>();
        refIds.add(new RelatedObservationIdentity(true, ObservationSubTypeEnum.DETECTION));
        refIds.add(new RelatedObservationIdentity(true, ObservationSubTypeEnum.AUDIO_METADATA));
        refIds.add(new RelatedObservationIdentity(true, null));
        when(obs.getRelatedObservationModels()).thenReturn(refIds);
        assertThat(m_SUT.tryGetMiniObservationImage(obs, -1), is("thoseIcons/observations/mini-icons/unknown.png"));
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 0), is("thoseIcons/observations/mini-icons/detection.png"));
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 1), 
                is("thoseIcons/observations/mini-icons/audio_metadata.png"));
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 2), is("thoseIcons/observations/mini-icons/unknown.png"));
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 3), is("thoseIcons/observations/mini-icons/unknown.png"));
        when(obs.getRelatedObservationModels()).thenReturn(new ArrayList<RelatedObservationIdentity>());
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 1), is("thoseIcons/observations/mini-icons/unknown.png"));
        assertThat(m_SUT.tryGetMiniObservationImage(null, -1), is("thoseIcons/observations/mini-icons/unknown.png"));
        List<RelatedObservationIdentity> list = mock(ArrayList.class);
        when(list.size()).thenReturn(1);
        when(obs.getRelatedObservationModels()).thenReturn(list);
        when(list.get(0)).thenReturn(null);
        assertThat(m_SUT.tryGetMiniObservationImage(obs, 0), is("thoseIcons/observations/mini-icons/unknown.png"));
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testTryGetMiniObservationImage ( ) { m_SUT = new ObservationImageService ( ) ; GuiObservation obs = mock ( GuiObservation . class ) ; List < RelatedObservationIdentity > refIds = new ArrayList < > ( ) ; refIds . add ( new RelatedObservationIdentity ( true , ObservationSubTypeEnum . DETECTION ) ) ; refIds . add ( new RelatedObservationIdentity ( true , ObservationSubTypeEnum . AUDIO_METADATA ) ) ; refIds . add ( new RelatedObservationIdentity ( true , null ) ) ; when ( obs . getRelatedObservationModels ( ) ) . thenReturn ( refIds ) ; assertThat ( m_SUT . tryGetMiniObservationImage ( obs , - 1 ) , is ( "thoseIcons/observations/mini-icons/unknown.png" ) ) ; assertThat ( m_SUT . tryGetMiniObservationImage ( obs , 0 ) , is ( "thoseIcons/observations/mini-icons/detection.png" ) ) ; assertThat ( m_SUT . tryGetMiniObservationImage ( obs , 1 ) , is ( "thoseIcons/observations/mini-icons/audio_metadata.png" ) ) ; assertThat ( m_SUT . tryGetMiniObservationImage ( obs , 2 ) , is ( "thoseIcons/observations/mini-icons/unknown.png" ) ) ; assertThat ( m_SUT . tryGetMiniObservationImage ( obs , 3 ) , is ( "thoseIcons/observations/mini-icons/unknown.png" ) ) ; when ( obs . getRelatedObservationModels ( ) ) . thenReturn ( new ArrayList < RelatedObservationIdentity > ( ) ) ; assertThat ( m_SUT . tryGetMiniObservationImage ( obs , 1 ) , is ( "thoseIcons/observations/mini-icons/unknown.png" ) ) ; assertThat ( m_SUT . tryGetMiniObservationImage ( null , - 1 ) , is ( "thoseIcons/observations/mini-icons/unknown.png" ) ) ; List < RelatedObservationIdentity > list = mock ( ArrayList . class ) ; when ( list . size ( ) ) . thenReturn ( 1 ) ; when ( obs . getRelatedObservationModels ( ) ) . thenReturn ( list ) ; when ( list . get ( 0 ) ) . thenReturn ( null ) ; assertThat ( m_SUT . tryGetMiniObservationImage ( obs , 0 ) , is ( "thoseIcons/observations/mini-icons/unknown.png" ) ) ; }
Verify that the correct mini observation image path is returned for the given inputs.
Verify that the correct mini observation image path is returned for the given inputs .