/*
** Module   : TerminalTestable.java
** Abstract : A terminal test.
**
** Copyright (c) 2021, Golden Code Development Corporation.
**
** -#- -I- --Date-- ---------------------------------------Description----------------------------------------
** 001 CA  20210827 Created initial version.
*/

/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package com.goldencode.harness.test;

import com.goldencode.harness.*;
import com.goldencode.harness.terminal.*;

/**
 * API for delegating the execution of a testable activity via a terminal.
 */
public interface TerminalTestable
extends Testable
{
   /**
    * Execute a testable activity using the given terminal as the data sink and/or source for the operation. 
    * The results of the processing must be stored such that they can be retrieved after this method returns.
    *
    * @param    term
    *           The terminal that represents the system under test.
    */
   public void execute(Terminal term);
   
   /**
    * Execute a testable activity.
    * 
    * @throws   IllegalStateException
    *           By default, this exception is throw - use {@link #execute(Terminal)} instead, or override in
    *           the implementation class.
    */
   @Override
   public default void execute()
   {
      throw new IllegalStateException("The terminal must be set!");
   }
   
   /**
    * Get the executor type of this test.
    * 
    * @return   The {@link TerminalTestExecutor}. 
    */
   @Override
   public default Class<? extends TestExecutor> getExecutor()
   {
      return TerminalTestExecutor.class;
   }
}
