Class TestingKernel

java.lang.Object
  extended by TestingKernel

public class TestingKernel
extends java.lang.Object

This class is the system's Testing Kernel. For now it is hard coded, sequential tests that will be performed. It tests the system and how it responds to such things as basic moves/jumps, illegal values, and illegal moves/jumps. All results will be outputted about pass/fail on the tests.

Version:
Author:

Field Summary
 java.lang.String playerOne
           
 java.lang.String playerTwo
           
 Board testBoard
           
 Facade testFacade
           
 int testTime
           
 Driver theDriver
           
 
Constructor Summary
TestingKernel(Driver aDriver)
          The constructor for this kernel which calls the other methods.
 
Method Summary
 void beginTests()
          Tests the intial values, then call the other methods.
static void main(java.lang.String[] args)
          The main method.
 void report(boolean passFail, java.lang.String name, int tabs)
          This method is for reporting.
 void setBegin()
          Set the state of the game to initial settings.
 void simpleWait()
          This method is a generic way to put in place an artificial wait into the program.
 boolean testBasicMoves()
          Test basic moves made by the checkers.
 boolean testBounds()
          This method will attempt to make moves with out of bound values to ensure the system detects these without throwing an OutOfBounds Exception.
 boolean testDraw()
          Tests the actions of the GUI and checks to see that both players may offer draws and accept/decline.
 boolean testForcedJump()
          Tests for the following: A jump is possible.
 boolean testInvalidMoves()
          Testing of a variety of invalid moves.
 boolean testMultJumps()
          When multiple jumps are present, this tests that they are forced and that the correct player keeps control of the game.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

testFacade

public Facade testFacade

theDriver

public Driver theDriver

testBoard

public Board testBoard

testTime

public int testTime

playerOne

public java.lang.String playerOne

playerTwo

public java.lang.String playerTwo
Constructor Detail

TestingKernel

public TestingKernel(Driver aDriver)
The constructor for this kernel which calls the other methods.

Parameters:
aFacade - The facade to manipulate in this program.
Method Detail

main

public static void main(java.lang.String[] args)
The main method. Create a new instance of the driver and then create an instance of kernel, pass it that driver, and start the program from there.

Parameters:
args - Array of command line arguments.

setBegin

public void setBegin()
Set the state of the game to initial settings. i.e., a generously timed local game for which to test.


beginTests

public void beginTests()
Tests the intial values, then call the other methods. Handles the reporting of the results.


testBasicMoves

public boolean testBasicMoves()
Test basic moves made by the checkers. This does not tests jumps or invalid moves.

Returns:
Whether or not it passed.

testBounds

public boolean testBounds()
This method will attempt to make moves with out of bound values to ensure the system detects these without throwing an OutOfBounds Exception. It will also test that the system detects making a move with the same start and end positions.

Returns:
Whether or not it passed the test.

testForcedJump

public boolean testForcedJump()
Tests for the following: A jump is possible. The player attempts to move elsewhere. System must not allow move and keep state unchanged.

Returns:
Whether or not it passed the test.

testMultJumps

public boolean testMultJumps()
When multiple jumps are present, this tests that they are forced and that the correct player keeps control of the game.

Returns:
Whether or not it passed the test.

testInvalidMoves

public boolean testInvalidMoves()
Testing of a variety of invalid moves.

Returns:
Whether or not it passed the test.

testDraw

public boolean testDraw()
Tests the actions of the GUI and checks to see that both players may offer draws and accept/decline.


report

public void report(boolean passFail,
                   java.lang.String name,
                   int tabs)
This method is for reporting. It outputs the name of the test and a Pass/Fail value along side of the test name.

Parameters:
passFail - Bool on whether or not test was passed.
name - Name of test.
tabs - The number of tabs to insert

simpleWait

public void simpleWait()
This method is a generic way to put in place an artificial wait into the program. This allows for the program to have a delay without having to implement anything such as Runnable.