mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestPersistence.java
public void testTotalNumberOfObservations() throws ValidationFailedException, 
        IllegalArgumentException, PersistenceFailedException
    {
        // should allow no parameters
        List<Observation> initialObs = 
                new ArrayList<>(m_ObservationStore.newQuery().withAssetType(ASSETTYPE).execute());
        assertThat((int)m_ObservationStore.newQuery().withAssetType(ASSETTYPE).getCount(), is(initialObs.size()));
        
        List<Observation> expectedObs = new ArrayList<>();
        for (int i = 0; i < 20; i++)
        {
            expectedObs.add(createObservation());
            if (i > 20 / 2)
            {
                // change the 2nd half to use a different asset type
                expectedObs.get(i).setAssetType("other-type");
            }
            m_ObservationStore.persist(expectedObs.get(i));
        }
        
        List<Observation> afterObs = new ArrayList<>(m_ObservationStore.newQuery().withAssetType(ASSETTYPE).execute());
        
        assertThat((int)m_ObservationStore.newQuery().withAssetType(ASSETTYPE).getCount(), is(afterObs.size()));
    }
/**
     * Verify that the correct number of observations is returned when count is requested for the specific asset. 
     */
Verify that the correct number of observations is returned when count is requested for the specific asset.
Verify that the correct number of observations is returned when count is requested for the specific asset .
public void testTotalNumberOfObservations() throws ValidationFailedException, 
        IllegalArgumentException, PersistenceFailedException
    {
        List<Observation> initialObs = 
                new ArrayList<>(m_ObservationStore.newQuery().withAssetType(ASSETTYPE).execute());
        assertThat((int)m_ObservationStore.newQuery().withAssetType(ASSETTYPE).getCount(), is(initialObs.size()));
        List<Observation> expectedObs = new ArrayList<>();
        for (int i = 0; i < 20; i++)
        {
            expectedObs.add(createObservation());
            if (i > 20 / 2)
            {
                expectedObs.get(i).setAssetType("other-type");
            }
            m_ObservationStore.persist(expectedObs.get(i));
        }
        List<Observation> afterObs = new ArrayList<>(m_ObservationStore.newQuery().withAssetType(ASSETTYPE).execute());
        assertThat((int)m_ObservationStore.newQuery().withAssetType(ASSETTYPE).getCount(), is(afterObs.size()));
    }
public void testTotalNumberOfObservations ( ) throws ValidationFailedException , IllegalArgumentException , PersistenceFailedException { List < Observation > initialObs = new ArrayList < > ( m_ObservationStore . newQuery ( ) . withAssetType ( ASSETTYPE ) . execute ( ) ) ; assertThat ( ( int ) m_ObservationStore . newQuery ( ) . withAssetType ( ASSETTYPE ) . getCount ( ) , is ( initialObs . size ( ) ) ) ; List < Observation > expectedObs = new ArrayList < > ( ) ; for ( int i = 0 ; i < 20 ; i ++ ) { expectedObs . add ( createObservation ( ) ) ; if ( i > 20 / 2 ) { expectedObs . get ( i ) . setAssetType ( "other-type" ) ; } m_ObservationStore . persist ( expectedObs . get ( i ) ) ; } List < Observation > afterObs = new ArrayList < > ( m_ObservationStore . newQuery ( ) . withAssetType ( ASSETTYPE ) . execute ( ) ) ; assertThat ( ( int ) m_ObservationStore . newQuery ( ) . withAssetType ( ASSETTYPE ) . getCount ( ) , is ( afterObs . size ( ) ) ) ; }
Verify that the correct number of observations is returned when count is requested for the specific asset.
Verify that the correct number of observations is returned when count is requested for the specific asset .
// should allow no parameters // change the 2nd half to use a different asset type