mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/TestAssetImpl.java
@Test
    public void testExecuteCommandValidationFail()
            throws CommandExecutionException, ValidationFailedException, InterruptedException
    {
        doThrow(new ValidationFailedException("failed")).when(m_Validator).validate(Mockito.any(Object.class));
        Command command = mock(Command.class);

        try
        {
            m_SUT.executeCommand(command);
            fail("expecting exception");
        }
        catch (CommandExecutionException ex)
        {
            // expecting exception
        }

        verify(m_WakeLock, never()).activate();
        verify(m_WakeLock, never()).cancel();
    }
/**
     * Verify exception can be thrown when validation of command fails.
     */
Verify exception can be thrown when validation of command fails.
Verify exception can be thrown when validation of command fails .
@Test
    public void testExecuteCommandValidationFail()
            throws CommandExecutionException, ValidationFailedException, InterruptedException
    {
        doThrow(new ValidationFailedException("failed")).when(m_Validator).validate(Mockito.any(Object.class));
        Command command = mock(Command.class);
        try
        {
            m_SUT.executeCommand(command);
            fail("expecting exception");
        }
        catch (CommandExecutionException ex)
        {
        }
        verify(m_WakeLock, never()).activate();
        verify(m_WakeLock, never()).cancel();
    }
@ Test public void testExecuteCommandValidationFail ( ) throws CommandExecutionException , ValidationFailedException , InterruptedException { doThrow ( new ValidationFailedException ( "failed" ) ) . when ( m_Validator ) . validate ( Mockito . any ( Object . class ) ) ; Command command = mock ( Command . class ) ; try { m_SUT . executeCommand ( command ) ; fail ( "expecting exception" ) ; } catch ( CommandExecutionException ex ) { } verify ( m_WakeLock , never ( ) ) . activate ( ) ; verify ( m_WakeLock , never ( ) ) . cancel ( ) ; }
Verify exception can be thrown when validation of command fails.
Verify exception can be thrown when validation of command fails .
// expecting exception