mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/observation/TestObservationMgrImpl.java
@Test
    public void testFilterByExpressionWithSelectedAsset()
    {
        AssetModel model1 = mock(AssetModel.class);
        UUID uuid = UUID.randomUUID();
        when(model1.getUuid()).thenReturn(uuid);
        when(m_AssetDisplayHelper.getSelectedFactoryObject()).thenReturn(model1);
        
        //settings
        m_SUT.setFilterByExpression(true);
        m_SUT.setFilter("filter");
        
        javax.jdo.Query query = mock(javax.jdo.Query.class);
        when(m_JdoStore.newJdoQuery()).thenReturn(query);
        
        //request for observations
        m_SUT.getObservations().load(0, 10, null, null, null);
        
        //verify calls to jdo store
        verify(m_JdoStore, times(2)).newJdoQuery();
        verify(query, times(2)).setFilter("filter " + "&& assetUuid == '"+ uuid.toString() + "'");
        verify(m_JdoStore).executeJdoQuery(query);
    }
/**
     * Verify the remote request to retrieve Observations via a filter string and by selected asset.
     */
Verify the remote request to retrieve Observations via a filter string and by selected asset.
Verify the remote request to retrieve Observations via a filter string and by selected asset .
@Test
    public void testFilterByExpressionWithSelectedAsset()
    {
        AssetModel model1 = mock(AssetModel.class);
        UUID uuid = UUID.randomUUID();
        when(model1.getUuid()).thenReturn(uuid);
        when(m_AssetDisplayHelper.getSelectedFactoryObject()).thenReturn(model1);
        m_SUT.setFilterByExpression(true);
        m_SUT.setFilter("filter");
        javax.jdo.Query query = mock(javax.jdo.Query.class);
        when(m_JdoStore.newJdoQuery()).thenReturn(query);
        m_SUT.getObservations().load(0, 10, null, null, null);
        verify(m_JdoStore, times(2)).newJdoQuery();
        verify(query, times(2)).setFilter("filter " + "&& assetUuid == '"+ uuid.toString() + "'");
        verify(m_JdoStore).executeJdoQuery(query);
    }
@ Test public void testFilterByExpressionWithSelectedAsset ( ) { AssetModel model1 = mock ( AssetModel . class ) ; UUID uuid = UUID . randomUUID ( ) ; when ( model1 . getUuid ( ) ) . thenReturn ( uuid ) ; when ( m_AssetDisplayHelper . getSelectedFactoryObject ( ) ) . thenReturn ( model1 ) ; m_SUT . setFilterByExpression ( true ) ; m_SUT . setFilter ( "filter" ) ; javax . jdo . Query query = mock ( javax . jdo . Query . class ) ; when ( m_JdoStore . newJdoQuery ( ) ) . thenReturn ( query ) ; m_SUT . getObservations ( ) . load ( 0 , 10 , null , null , null ) ; verify ( m_JdoStore , times ( 2 ) ) . newJdoQuery ( ) ; verify ( query , times ( 2 ) ) . setFilter ( "filter " + "&& assetUuid == '" + uuid . toString ( ) + "'" ) ; verify ( m_JdoStore ) . executeJdoQuery ( query ) ; }
Verify the remote request to retrieve Observations via a filter string and by selected asset.
Verify the remote request to retrieve Observations via a filter string and by selected asset .
//settings //request for observations //verify calls to jdo store