mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/observation/TestObservationMgrImpl.java
@Test
    public void testObservationWithNoSelectedObject()
    {
        List<Observation> expectedObs = new ArrayList<Observation>();
        
        UUID uuid1 = UUID.randomUUID();
        UUID uuid2 = UUID.randomUUID();
        UUID uuid3 = UUID.randomUUID();
        UUID uuid4 = UUID.randomUUID();
        UUID uuid5 = UUID.randomUUID();
        UUID uuid6 = UUID.randomUUID();
        
        expectedObs.add(createMockedObservation(uuid1, 1000L, true, ObservationSubTypeEnum.DETECTION));
        expectedObs.add(createMockedObservation(uuid2, 2000L, true, ObservationSubTypeEnum.VIDEO_METADATA));
        expectedObs.add(createMockedObservation(uuid3, 3000L, true, ObservationSubTypeEnum.WATER_QUALITY));
        expectedObs.add(createMockedObservation(uuid4, 4000L, true, ObservationSubTypeEnum.AUDIO_METADATA));
        expectedObs.add(createMockedObservation(uuid5, 5000L, true, ObservationSubTypeEnum.CHEMICAL));
        expectedObs.add(createMockedObservation(uuid6, 6000L, true, ObservationSubTypeEnum.POWER));
        
        when(m_ObsQuery.execute()).thenReturn(expectedObs);
        
        List<GuiObservation> listObs = m_SUT.getObservations().load(0, 10, null, null, null);
        
        assertThat(listObs.size(), is(6));
        
        assertThat(listObs.get(0).getObservation().getUuid(), is(expectedObs.get(0).getUuid()));
        assertThat(listObs.get(1).getObservation().getUuid(), is(expectedObs.get(1).getUuid()));
        assertThat(listObs.get(2).getObservation().getUuid(), is(expectedObs.get(2).getUuid()));
        assertThat(listObs.get(3).getObservation().getUuid(), is(expectedObs.get(3).getUuid()));
        assertThat(listObs.get(4).getObservation().getUuid(), is(expectedObs.get(4).getUuid()));
        assertThat(listObs.get(5).getObservation().getUuid(), is(expectedObs.get(5).getUuid()));
        
        verify(m_ObsQuery, never()).withAssetUuid(Mockito.any(UUID.class));
        
        verify(m_ObsCount).getCount();
        verify(m_ObsQuery).execute();
    }
/**
     * Verify that getting observations with null input returns 
     * all observations
     */
Verify that getting observations with null input returns
all observations
Verify that getting observations with null input returns all observations
@Test
    public void testObservationWithNoSelectedObject()
    {
        List<Observation> expectedObs = new ArrayList<Observation>();
        UUID uuid1 = UUID.randomUUID();
        UUID uuid2 = UUID.randomUUID();
        UUID uuid3 = UUID.randomUUID();
        UUID uuid4 = UUID.randomUUID();
        UUID uuid5 = UUID.randomUUID();
        UUID uuid6 = UUID.randomUUID();
        expectedObs.add(createMockedObservation(uuid1, 1000L, true, ObservationSubTypeEnum.DETECTION));
        expectedObs.add(createMockedObservation(uuid2, 2000L, true, ObservationSubTypeEnum.VIDEO_METADATA));
        expectedObs.add(createMockedObservation(uuid3, 3000L, true, ObservationSubTypeEnum.WATER_QUALITY));
        expectedObs.add(createMockedObservation(uuid4, 4000L, true, ObservationSubTypeEnum.AUDIO_METADATA));
        expectedObs.add(createMockedObservation(uuid5, 5000L, true, ObservationSubTypeEnum.CHEMICAL));
        expectedObs.add(createMockedObservation(uuid6, 6000L, true, ObservationSubTypeEnum.POWER));
        when(m_ObsQuery.execute()).thenReturn(expectedObs);
        List<GuiObservation> listObs = m_SUT.getObservations().load(0, 10, null, null, null);
        assertThat(listObs.size(), is(6));
        assertThat(listObs.get(0).getObservation().getUuid(), is(expectedObs.get(0).getUuid()));
        assertThat(listObs.get(1).getObservation().getUuid(), is(expectedObs.get(1).getUuid()));
        assertThat(listObs.get(2).getObservation().getUuid(), is(expectedObs.get(2).getUuid()));
        assertThat(listObs.get(3).getObservation().getUuid(), is(expectedObs.get(3).getUuid()));
        assertThat(listObs.get(4).getObservation().getUuid(), is(expectedObs.get(4).getUuid()));
        assertThat(listObs.get(5).getObservation().getUuid(), is(expectedObs.get(5).getUuid()));
        verify(m_ObsQuery, never()).withAssetUuid(Mockito.any(UUID.class));
        verify(m_ObsCount).getCount();
        verify(m_ObsQuery).execute();
    }
@ Test public void testObservationWithNoSelectedObject ( ) { List < Observation > expectedObs = new ArrayList < Observation > ( ) ; UUID uuid1 = UUID . randomUUID ( ) ; UUID uuid2 = UUID . randomUUID ( ) ; UUID uuid3 = UUID . randomUUID ( ) ; UUID uuid4 = UUID . randomUUID ( ) ; UUID uuid5 = UUID . randomUUID ( ) ; UUID uuid6 = UUID . randomUUID ( ) ; expectedObs . add ( createMockedObservation ( uuid1 , 1000L , true , ObservationSubTypeEnum . DETECTION ) ) ; expectedObs . add ( createMockedObservation ( uuid2 , 2000L , true , ObservationSubTypeEnum . VIDEO_METADATA ) ) ; expectedObs . add ( createMockedObservation ( uuid3 , 3000L , true , ObservationSubTypeEnum . WATER_QUALITY ) ) ; expectedObs . add ( createMockedObservation ( uuid4 , 4000L , true , ObservationSubTypeEnum . AUDIO_METADATA ) ) ; expectedObs . add ( createMockedObservation ( uuid5 , 5000L , true , ObservationSubTypeEnum . CHEMICAL ) ) ; expectedObs . add ( createMockedObservation ( uuid6 , 6000L , true , ObservationSubTypeEnum . POWER ) ) ; when ( m_ObsQuery . execute ( ) ) . thenReturn ( expectedObs ) ; List < GuiObservation > listObs = m_SUT . getObservations ( ) . load ( 0 , 10 , null , null , null ) ; assertThat ( listObs . size ( ) , is ( 6 ) ) ; assertThat ( listObs . get ( 0 ) . getObservation ( ) . getUuid ( ) , is ( expectedObs . get ( 0 ) . getUuid ( ) ) ) ; assertThat ( listObs . get ( 1 ) . getObservation ( ) . getUuid ( ) , is ( expectedObs . get ( 1 ) . getUuid ( ) ) ) ; assertThat ( listObs . get ( 2 ) . getObservation ( ) . getUuid ( ) , is ( expectedObs . get ( 2 ) . getUuid ( ) ) ) ; assertThat ( listObs . get ( 3 ) . getObservation ( ) . getUuid ( ) , is ( expectedObs . get ( 3 ) . getUuid ( ) ) ) ; assertThat ( listObs . get ( 4 ) . getObservation ( ) . getUuid ( ) , is ( expectedObs . get ( 4 ) . getUuid ( ) ) ) ; assertThat ( listObs . get ( 5 ) . getObservation ( ) . getUuid ( ) , is ( expectedObs . get ( 5 ) . getUuid ( ) ) ) ; verify ( m_ObsQuery , never ( ) ) . withAssetUuid ( Mockito . any ( UUID . class ) ) ; verify ( m_ObsCount ) . getCount ( ) ; verify ( m_ObsQuery ) . execute ( ) ; }
Verify that getting observations with null input returns
 all observations
Verify that getting observations with null input returns all observations