mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/observation/TestObservationMgrImpl.java
@Test
    public void testCheckFilterException()
    {
        javax.jdo.Query jdoQuery = mock(javax.jdo.Query.class);
        when(m_JdoStore.newJdoQuery()).thenReturn(jdoQuery);
        
        //mocks
        FacesContext context = mock(FacesContext.class);
        UIComponent component = mock(UIComponent.class);
        
        //settings
        String filter = "filter";
        m_SUT.setFilterByExpression(true);
        m_SUT.setFilter(filter);

        doThrow(new IllegalArgumentException("e")).when(jdoQuery).compile();
        
        //request check
        try
        {
            m_SUT.checkFilter(context, component, filter);
            fail("Expected exception from jdo object query.");
        }
        catch (ValidatorException e)
        {
            //expected
        }
    }
/**
     * Verify validation exception if filter expression is invalid.
     */
Verify validation exception if filter expression is invalid.
Verify validation exception if filter expression is invalid .
@Test
    public void testCheckFilterException()
    {
        javax.jdo.Query jdoQuery = mock(javax.jdo.Query.class);
        when(m_JdoStore.newJdoQuery()).thenReturn(jdoQuery);
        FacesContext context = mock(FacesContext.class);
        UIComponent component = mock(UIComponent.class);
        String filter = "filter";
        m_SUT.setFilterByExpression(true);
        m_SUT.setFilter(filter);
        doThrow(new IllegalArgumentException("e")).when(jdoQuery).compile();
        try
        {
            m_SUT.checkFilter(context, component, filter);
            fail("Expected exception from jdo object query.");
        }
        catch (ValidatorException e)
        {
        }
    }
@ Test public void testCheckFilterException ( ) { javax . jdo . Query jdoQuery = mock ( javax . jdo . Query . class ) ; when ( m_JdoStore . newJdoQuery ( ) ) . thenReturn ( jdoQuery ) ; FacesContext context = mock ( FacesContext . class ) ; UIComponent component = mock ( UIComponent . class ) ; String filter = "filter" ; m_SUT . setFilterByExpression ( true ) ; m_SUT . setFilter ( filter ) ; doThrow ( new IllegalArgumentException ( "e" ) ) . when ( jdoQuery ) . compile ( ) ; try { m_SUT . checkFilter ( context , component , filter ) ; fail ( "Expected exception from jdo object query." ) ; } catch ( ValidatorException e ) { } }
Verify validation exception if filter expression is invalid.
Verify validation exception if filter expression is invalid .
//mocks //settings //request check //expected