mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/persistence/TestObservationQueryImpl.java
@Test
    public void testGetCountWithQuery()
    {
        when(m_DataStore.executeGetCount(Mockito.any(Query.class))).thenReturn(10L);
        
        ObservationQuery rv = m_SUT.withAssetType("blah").withSubType(ObservationSubTypeEnum.DETECTION);
        
        long count = rv.getCount();
        
        assertThat(count, is(10L));
        
        ArgumentCaptor<Query> query = ArgumentCaptor.forClass(Query.class);
        verify(m_DataStore).executeGetCount(query.capture());
        
        // verify
        ArgumentCaptor<String> stringCaptor = ArgumentCaptor.forClass(String.class);
        verify(query.getValue()).setFilter(stringCaptor.capture());
        
        // might be in either order
        assertThat(stringCaptor.getValue(), anyOf(is("assetType == 'blah' && this.detection.id > 0"),
                                                  is("this.detection.id > 0 && assetType == 'blah'")));
    }
/**
     * Verify that a count with query parameters properly executed.
     */
Verify that a count with query parameters properly executed.
Verify that a count with query parameters properly executed .
@Test
    public void testGetCountWithQuery()
    {
        when(m_DataStore.executeGetCount(Mockito.any(Query.class))).thenReturn(10L);
        ObservationQuery rv = m_SUT.withAssetType("blah").withSubType(ObservationSubTypeEnum.DETECTION);
        long count = rv.getCount();
        assertThat(count, is(10L));
        ArgumentCaptor<Query> query = ArgumentCaptor.forClass(Query.class);
        verify(m_DataStore).executeGetCount(query.capture());
        ArgumentCaptor<String> stringCaptor = ArgumentCaptor.forClass(String.class);
        verify(query.getValue()).setFilter(stringCaptor.capture());
        assertThat(stringCaptor.getValue(), anyOf(is("assetType == 'blah' && this.detection.id > 0"),
                                                  is("this.detection.id > 0 && assetType == 'blah'")));
    }
@ Test public void testGetCountWithQuery ( ) { when ( m_DataStore . executeGetCount ( Mockito . any ( Query . class ) ) ) . thenReturn ( 10L ) ; ObservationQuery rv = m_SUT . withAssetType ( "blah" ) . withSubType ( ObservationSubTypeEnum . DETECTION ) ; long count = rv . getCount ( ) ; assertThat ( count , is ( 10L ) ) ; ArgumentCaptor < Query > query = ArgumentCaptor . forClass ( Query . class ) ; verify ( m_DataStore ) . executeGetCount ( query . capture ( ) ) ; ArgumentCaptor < String > stringCaptor = ArgumentCaptor . forClass ( String . class ) ; verify ( query . getValue ( ) ) . setFilter ( stringCaptor . capture ( ) ) ; assertThat ( stringCaptor . getValue ( ) , anyOf ( is ( "assetType == 'blah' && this.detection.id > 0" ) , is ( "this.detection.id > 0 && assetType == 'blah'" ) ) ) ; }
Verify that a count with query parameters properly executed.
Verify that a count with query parameters properly executed .
// verify // might be in either order