mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/persistence/TestObservationQueryImpl.java
@Test
    public void testWithMultipleFilters()
    {
        // replay
        ObservationQuery rv = m_SUT.withAssetType("blah").withSubType(ObservationSubTypeEnum.DETECTION);
        m_SUT.execute();
        
        ArgumentCaptor<Query> query = ArgumentCaptor.forClass(Query.class);
        verify(m_DataStore).executeJdoQuery(query.capture());
        
        // verify return value is the same object for method chaining
        assertThat((ObservationQueryImpl)rv, is(m_SUT));
        
        // 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 calling with multiple filters different filter types combines the properties.
     */
Verify calling with multiple filters different filter types combines the properties.
Verify calling with multiple filters different filter types combines the properties .
@Test
    public void testWithMultipleFilters()
    {
        ObservationQuery rv = m_SUT.withAssetType("blah").withSubType(ObservationSubTypeEnum.DETECTION);
        m_SUT.execute();
        ArgumentCaptor<Query> query = ArgumentCaptor.forClass(Query.class);
        verify(m_DataStore).executeJdoQuery(query.capture());
        assertThat((ObservationQueryImpl)rv, is(m_SUT));
        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 testWithMultipleFilters ( ) { ObservationQuery rv = m_SUT . withAssetType ( "blah" ) . withSubType ( ObservationSubTypeEnum . DETECTION ) ; m_SUT . execute ( ) ; ArgumentCaptor < Query > query = ArgumentCaptor . forClass ( Query . class ) ; verify ( m_DataStore ) . executeJdoQuery ( query . capture ( ) ) ; assertThat ( ( ObservationQueryImpl ) rv , is ( m_SUT ) ) ; 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 calling with multiple filters different filter types combines the properties.
Verify calling with multiple filters different filter types combines the properties .
// replay // verify return value is the same object for method chaining // verify // might be in either order