mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/TestAssetImpl.java
@Test
    public void testCaptureDataFailsPersisting() throws ValidationFailedException
    {
        Observation observation = new Observation();

        doThrow(new ValidationFailedException()).when(m_ObservationStore).persist(Mockito.any(Observation.class));

        try
        {
            when(m_Proxy.onCaptureData()).thenReturn(observation);
            m_SUT.captureData();
            fail("expected an exception");
        }
        catch (AssetException ex)
        {
            // expected exception
        }

        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
    }
/**
     * Verify that if validation fails then an asset exception is thrown.
     */
Verify that if validation fails then an asset exception is thrown.
Verify that if validation fails then an asset exception is thrown .
@Test
    public void testCaptureDataFailsPersisting() throws ValidationFailedException
    {
        Observation observation = new Observation();
        doThrow(new ValidationFailedException()).when(m_ObservationStore).persist(Mockito.any(Observation.class));
        try
        {
            when(m_Proxy.onCaptureData()).thenReturn(observation);
            m_SUT.captureData();
            fail("expected an exception");
        }
        catch (AssetException ex)
        {
        }
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
    }
@ Test public void testCaptureDataFailsPersisting ( ) throws ValidationFailedException { Observation observation = new Observation ( ) ; doThrow ( new ValidationFailedException ( ) ) . when ( m_ObservationStore ) . persist ( Mockito . any ( Observation . class ) ) ; try { when ( m_Proxy . onCaptureData ( ) ) . thenReturn ( observation ) ; m_SUT . captureData ( ) ; fail ( "expected an exception" ) ; } catch ( AssetException ex ) { } verify ( m_WakeLock ) . activate ( ) ; verify ( m_WakeLock ) . cancel ( ) ; }
Verify that if validation fails then an asset exception is thrown.
Verify that if validation fails then an asset exception is thrown .
// expected exception