mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/persistence/TestObservationQueryImpl.java
@Test
    public void testExecuteDefaultQuery()
    {
        // mock
        Observation obs1 = new Observation().withCreatedTimestamp(100L);
        Observation obs2 = new Observation().withCreatedTimestamp(200L);
        Collection<Observation> expectedObs = new ArrayList<>(Arrays.asList(obs1, obs2));
        when(m_DataStore.executeJdoQuery(Mockito.any(Query.class))).thenReturn(expectedObs);
        
        // replay
        Collection<Observation> actualObs = m_SUT.execute();
        
        ArgumentCaptor<Query> query = ArgumentCaptor.forClass(Query.class);
        verify(m_DataStore).executeJdoQuery(query.capture());
        
        // verify order
        verify(query.getValue()).setOrdering("createdTimestamp descending");
        // verify no range
        verify(query.getValue(), never()).setRange(anyLong(), anyLong());
        // verify no filter
        verify(query.getValue(), never()).setFilter(anyString());
        
        assertThat(actualObs, contains(obs1, obs2));
    }
/**
     * Verify execute passes JDO query with the default order of descending and no filtering or range is set.
     */
Verify execute passes JDO query with the default order of descending and no filtering or range is set.
Verify execute passes JDO query with the default order of descending and no filtering or range is set .
@Test
    public void testExecuteDefaultQuery()
    {
        Observation obs1 = new Observation().withCreatedTimestamp(100L);
        Observation obs2 = new Observation().withCreatedTimestamp(200L);
        Collection<Observation> expectedObs = new ArrayList<>(Arrays.asList(obs1, obs2));
        when(m_DataStore.executeJdoQuery(Mockito.any(Query.class))).thenReturn(expectedObs);
        Collection<Observation> actualObs = m_SUT.execute();
        ArgumentCaptor<Query> query = ArgumentCaptor.forClass(Query.class);
        verify(m_DataStore).executeJdoQuery(query.capture());
        verify(query.getValue()).setOrdering("createdTimestamp descending");
        verify(query.getValue(), never()).setRange(anyLong(), anyLong());
        verify(query.getValue(), never()).setFilter(anyString());
        assertThat(actualObs, contains(obs1, obs2));
    }
@ Test public void testExecuteDefaultQuery ( ) { Observation obs1 = new Observation ( ) . withCreatedTimestamp ( 100L ) ; Observation obs2 = new Observation ( ) . withCreatedTimestamp ( 200L ) ; Collection < Observation > expectedObs = new ArrayList < > ( Arrays . asList ( obs1 , obs2 ) ) ; when ( m_DataStore . executeJdoQuery ( Mockito . any ( Query . class ) ) ) . thenReturn ( expectedObs ) ; Collection < Observation > actualObs = m_SUT . execute ( ) ; ArgumentCaptor < Query > query = ArgumentCaptor . forClass ( Query . class ) ; verify ( m_DataStore ) . executeJdoQuery ( query . capture ( ) ) ; verify ( query . getValue ( ) ) . setOrdering ( "createdTimestamp descending" ) ; verify ( query . getValue ( ) , never ( ) ) . setRange ( anyLong ( ) , anyLong ( ) ) ; verify ( query . getValue ( ) , never ( ) ) . setFilter ( anyString ( ) ) ; assertThat ( actualObs , contains ( obs1 , obs2 ) ) ; }
Verify execute passes JDO query with the default order of descending and no filtering or range is set.
Verify execute passes JDO query with the default order of descending and no filtering or range is set .
// mock // replay // verify order // verify no range // verify no filter