mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/observation/TestObservationMgrImpl.java
@Test
    public void testGetDisplayObservationsUnableToFindObservation()
    {
        AssetModel model1 = mock(AssetModel.class);
        UUID uuid = UUID.randomUUID();
        when(model1.getUuid()).thenReturn(uuid);
        
        UUID uuid1 = UUID.randomUUID();
        UUID uuid2 = UUID.randomUUID();
        
        List<Observation> expectedObs = new ArrayList<Observation>();
        expectedObs.add(createMockedObservation(uuid1, 4000L, false, ObservationSubTypeEnum.DETECTION));
        expectedObs.add(createMockedObservation(uuid2, 2000L, true, ObservationSubTypeEnum.STATUS));
        
        when(m_ObsQuery.execute()).thenReturn(expectedObs);
        
        List<GuiObservation> listObs = m_SUT.getObservations().load(0, 10, null, null, null);
        assertThat(listObs.size(), is(2));
        assertThat(listObs.get(0).getObservation().getUuid(), is(uuid1));
        assertThat(listObs.get(0).getRelatedObservationModels().size(), is(1));
        assertThat(listObs.get(0).getRelatedObservationModels().get(0).getObservationSubType(), nullValue());
        assertThat(listObs.get(0).getRelatedObservationModels().get(0).isFoundInObsStore(), is(false));
        
        assertThat(listObs.get(1).getObservation().getUuid(), is(uuid2));
        assertThat(listObs.get(1).getRelatedObservationModels().size(), is(1));
        assertThat(listObs.get(1).getRelatedObservationModels().get(0).getObservationSubType(), 
                is(ObservationSubTypeEnum.STATUS));
        assertThat(listObs.get(1).getRelatedObservationModels().get(0).isFoundInObsStore(), is(true));
    }
/**
     * Verify that if an observation is not found still return an observation type to
     * be placed in the gui observation.
     */
Verify that if an observation is not found still return an observation type to
be placed in the gui observation.
Verify that if an observation is not found still return an observation type to be placed in the gui observation .
@Test
    public void testGetDisplayObservationsUnableToFindObservation()
    {
        AssetModel model1 = mock(AssetModel.class);
        UUID uuid = UUID.randomUUID();
        when(model1.getUuid()).thenReturn(uuid);
        UUID uuid1 = UUID.randomUUID();
        UUID uuid2 = UUID.randomUUID();
        List<Observation> expectedObs = new ArrayList<Observation>();
        expectedObs.add(createMockedObservation(uuid1, 4000L, false, ObservationSubTypeEnum.DETECTION));
        expectedObs.add(createMockedObservation(uuid2, 2000L, true, ObservationSubTypeEnum.STATUS));
        when(m_ObsQuery.execute()).thenReturn(expectedObs);
        List<GuiObservation> listObs = m_SUT.getObservations().load(0, 10, null, null, null);
        assertThat(listObs.size(), is(2));
        assertThat(listObs.get(0).getObservation().getUuid(), is(uuid1));
        assertThat(listObs.get(0).getRelatedObservationModels().size(), is(1));
        assertThat(listObs.get(0).getRelatedObservationModels().get(0).getObservationSubType(), nullValue());
        assertThat(listObs.get(0).getRelatedObservationModels().get(0).isFoundInObsStore(), is(false));
        assertThat(listObs.get(1).getObservation().getUuid(), is(uuid2));
        assertThat(listObs.get(1).getRelatedObservationModels().size(), is(1));
        assertThat(listObs.get(1).getRelatedObservationModels().get(0).getObservationSubType(), 
                is(ObservationSubTypeEnum.STATUS));
        assertThat(listObs.get(1).getRelatedObservationModels().get(0).isFoundInObsStore(), is(true));
    }
@ Test public void testGetDisplayObservationsUnableToFindObservation ( ) { AssetModel model1 = mock ( AssetModel . class ) ; UUID uuid = UUID . randomUUID ( ) ; when ( model1 . getUuid ( ) ) . thenReturn ( uuid ) ; UUID uuid1 = UUID . randomUUID ( ) ; UUID uuid2 = UUID . randomUUID ( ) ; List < Observation > expectedObs = new ArrayList < Observation > ( ) ; expectedObs . add ( createMockedObservation ( uuid1 , 4000L , false , ObservationSubTypeEnum . DETECTION ) ) ; expectedObs . add ( createMockedObservation ( uuid2 , 2000L , true , ObservationSubTypeEnum . STATUS ) ) ; when ( m_ObsQuery . execute ( ) ) . thenReturn ( expectedObs ) ; List < GuiObservation > listObs = m_SUT . getObservations ( ) . load ( 0 , 10 , null , null , null ) ; assertThat ( listObs . size ( ) , is ( 2 ) ) ; assertThat ( listObs . get ( 0 ) . getObservation ( ) . getUuid ( ) , is ( uuid1 ) ) ; assertThat ( listObs . get ( 0 ) . getRelatedObservationModels ( ) . size ( ) , is ( 1 ) ) ; assertThat ( listObs . get ( 0 ) . getRelatedObservationModels ( ) . get ( 0 ) . getObservationSubType ( ) , nullValue ( ) ) ; assertThat ( listObs . get ( 0 ) . getRelatedObservationModels ( ) . get ( 0 ) . isFoundInObsStore ( ) , is ( false ) ) ; assertThat ( listObs . get ( 1 ) . getObservation ( ) . getUuid ( ) , is ( uuid2 ) ) ; assertThat ( listObs . get ( 1 ) . getRelatedObservationModels ( ) . size ( ) , is ( 1 ) ) ; assertThat ( listObs . get ( 1 ) . getRelatedObservationModels ( ) . get ( 0 ) . getObservationSubType ( ) , is ( ObservationSubTypeEnum . STATUS ) ) ; assertThat ( listObs . get ( 1 ) . getRelatedObservationModels ( ) . get ( 0 ) . isFoundInObsStore ( ) , is ( true ) ) ; }
Verify that if an observation is not found still return an observation type to
 be placed in the gui observation.
Verify that if an observation is not found still return an observation type to be placed in the gui observation .