mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/observation/TestRemoteObservationListener.java
@Test
    public void testFindObservationResponsePersistMerge() throws ObjectConverterException, 
        IllegalArgumentException, PersistenceFailedException, ValidationFailedException
    {
        //mocks for converter
        Observation obsJaxb = mock(Observation.class);
        when(obsJaxb.getUuid()).thenReturn(UUID.randomUUID());
        
        //mock behavior
        when(m_Converter.convertToJaxb(Mockito.any(Message.class))).thenReturn(obsJaxb);
        when(m_ObservationStore.find(Mockito.any(UUID.class))).thenReturn(obsJaxb);

        m_ObservationHandler.handleEvent(findObservationsEvent());

        verify(m_ObservationStore, timeout(100).times(3)).remove(obsJaxb);
        verify(m_ObservationStore, timeout(100).times(3)).persist(Mockito.any(Observation.class));
    }
/**
     * Test loading an observation namespace message where the observation already exists.
     * Verify that the observations are removed.
     * Verify validated observation is persisted, replacing the already existent observation.
     */
Test loading an observation namespace message where the observation already exists.
Verify that the observations are removed.
Verify validated observation is persisted, replacing the already existent observation.
Test loading an observation namespace message where the observation already exists . Verify that the observations are removed . Verify validated observation is persisted replacing the already existent observation .
@Test
    public void testFindObservationResponsePersistMerge() throws ObjectConverterException, 
        IllegalArgumentException, PersistenceFailedException, ValidationFailedException
    {
        Observation obsJaxb = mock(Observation.class);
        when(obsJaxb.getUuid()).thenReturn(UUID.randomUUID());
        when(m_Converter.convertToJaxb(Mockito.any(Message.class))).thenReturn(obsJaxb);
        when(m_ObservationStore.find(Mockito.any(UUID.class))).thenReturn(obsJaxb);
        m_ObservationHandler.handleEvent(findObservationsEvent());
        verify(m_ObservationStore, timeout(100).times(3)).remove(obsJaxb);
        verify(m_ObservationStore, timeout(100).times(3)).persist(Mockito.any(Observation.class));
    }
@ Test public void testFindObservationResponsePersistMerge ( ) throws ObjectConverterException , IllegalArgumentException , PersistenceFailedException , ValidationFailedException { Observation obsJaxb = mock ( Observation . class ) ; when ( obsJaxb . getUuid ( ) ) . thenReturn ( UUID . randomUUID ( ) ) ; when ( m_Converter . convertToJaxb ( Mockito . any ( Message . class ) ) ) . thenReturn ( obsJaxb ) ; when ( m_ObservationStore . find ( Mockito . any ( UUID . class ) ) ) . thenReturn ( obsJaxb ) ; m_ObservationHandler . handleEvent ( findObservationsEvent ( ) ) ; verify ( m_ObservationStore , timeout ( 100 ) . times ( 3 ) ) . remove ( obsJaxb ) ; verify ( m_ObservationStore , timeout ( 100 ) . times ( 3 ) ) . persist ( Mockito . any ( Observation . class ) ) ; }
Test loading an observation namespace message where the observation already exists.
Test loading an observation namespace message where the observation already exists .
//mocks for converter //mock behavior