mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/observation/TestRetrieveDeleteObsHelperImpl.java
@Test
    public void testRemoteDeletionAllAssetsTimeConstraintNullStart()
    {
        ObservationQuery query = mock(ObservationQuery.class);
        //mock obs store behavior
        when(m_ObservationStore.newQuery()).thenReturn(query);
        when(query.withAssetUuid(Mockito.any(UUID.class))).thenReturn(query);
        when(query.withTimeCreatedRange(Mockito.any(Date.class), Mockito.any(Date.class))).thenReturn(query);
        when(query.remove()).thenReturn(2L);
        
        //date objs
        Date stop = new Date(5L);
        
        //dates
        m_SUT.setRetrieveByMaxObsNum(false);
        m_SUT.setRetrieveDeleteByDate(true);
        m_SUT.setStartDate(null);
        m_SUT.setEndDate(stop);
        
        //request for observations
        m_SUT.submitDeleteObservationsRequest(null);
        
        //verify call to remote message sender for all asset observations
        ArgumentCaptor<Message> messageCaptor = ArgumentCaptor.forClass(Message.class);
        //request
        verify(m_MessageFactory).createObservationStoreMessage(
            eq(ObservationStoreMessageType.RemoveObservationRequest), messageCaptor.capture());
        verify(m_MessageWrapper).queue(eq(CONTROLLER_ID), eq((ResponseHandler)null));
        
        //verify data messages
        RemoveObservationRequestData requestData = (RemoveObservationRequestData)messageCaptor.getAllValues().get(0);
        Query queryData = requestData.getObsQuery();
        assertThat(queryData.hasCreatedTimeRange(), is(false));
        
        assertThat(queryData.hasAssetType(), is(false));
        
        //verify local remove call
        verify(query).remove();
    }
/**
     * Verify the remote request to delete Observations for all known assets with time constraint and start time is 
     * null.
     */
Verify the remote request to delete Observations for all known assets with time constraint and start time is
null.
Verify the remote request to delete Observations for all known assets with time constraint and start time is null .
@Test
    public void testRemoteDeletionAllAssetsTimeConstraintNullStart()
    {
        ObservationQuery query = mock(ObservationQuery.class);
        when(m_ObservationStore.newQuery()).thenReturn(query);
        when(query.withAssetUuid(Mockito.any(UUID.class))).thenReturn(query);
        when(query.withTimeCreatedRange(Mockito.any(Date.class), Mockito.any(Date.class))).thenReturn(query);
        when(query.remove()).thenReturn(2L);
        Date stop = new Date(5L);
        m_SUT.setRetrieveByMaxObsNum(false);
        m_SUT.setRetrieveDeleteByDate(true);
        m_SUT.setStartDate(null);
        m_SUT.setEndDate(stop);
        m_SUT.submitDeleteObservationsRequest(null);
        ArgumentCaptor<Message> messageCaptor = ArgumentCaptor.forClass(Message.class);
        verify(m_MessageFactory).createObservationStoreMessage(
            eq(ObservationStoreMessageType.RemoveObservationRequest), messageCaptor.capture());
        verify(m_MessageWrapper).queue(eq(CONTROLLER_ID), eq((ResponseHandler)null));
        RemoveObservationRequestData requestData = (RemoveObservationRequestData)messageCaptor.getAllValues().get(0);
        Query queryData = requestData.getObsQuery();
        assertThat(queryData.hasCreatedTimeRange(), is(false));
        assertThat(queryData.hasAssetType(), is(false));
        verify(query).remove();
    }
@ Test public void testRemoteDeletionAllAssetsTimeConstraintNullStart ( ) { ObservationQuery query = mock ( ObservationQuery . class ) ; when ( m_ObservationStore . newQuery ( ) ) . thenReturn ( query ) ; when ( query . withAssetUuid ( Mockito . any ( UUID . class ) ) ) . thenReturn ( query ) ; when ( query . withTimeCreatedRange ( Mockito . any ( Date . class ) , Mockito . any ( Date . class ) ) ) . thenReturn ( query ) ; when ( query . remove ( ) ) . thenReturn ( 2L ) ; Date stop = new Date ( 5L ) ; m_SUT . setRetrieveByMaxObsNum ( false ) ; m_SUT . setRetrieveDeleteByDate ( true ) ; m_SUT . setStartDate ( null ) ; m_SUT . setEndDate ( stop ) ; m_SUT . submitDeleteObservationsRequest ( null ) ; ArgumentCaptor < Message > messageCaptor = ArgumentCaptor . forClass ( Message . class ) ; verify ( m_MessageFactory ) . createObservationStoreMessage ( eq ( ObservationStoreMessageType . RemoveObservationRequest ) , messageCaptor . capture ( ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( CONTROLLER_ID ) , eq ( ( ResponseHandler ) null ) ) ; RemoveObservationRequestData requestData = ( RemoveObservationRequestData ) messageCaptor . getAllValues ( ) . get ( 0 ) ; Query queryData = requestData . getObsQuery ( ) ; assertThat ( queryData . hasCreatedTimeRange ( ) , is ( false ) ) ; assertThat ( queryData . hasAssetType ( ) , is ( false ) ) ; verify ( query ) . remove ( ) ; }
Verify the remote request to delete Observations for all known assets with time constraint and start time is
 null.
Verify the remote request to delete Observations for all known assets with time constraint and start time is null .
//mock obs store behavior //date objs //dates //request for observations //verify call to remote message sender for all asset observations //request //verify data messages //verify local remove call