jfreerails.move
Class AbstractMoveTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by jfreerails.move.AbstractMoveTestCase
All Implemented Interfaces:
junit.framework.Test

public abstract class AbstractMoveTestCase
extends junit.framework.TestCase

All TestCases for moves should extend this class.

Author:
Luke

Field Summary
private  boolean hasSetupBeenCalled
           
protected  World world
           
 
Constructor Summary
protected AbstractMoveTestCase()
           
  AbstractMoveTestCase(java.lang.String str)
           
 
Method Summary
protected  void assertDoMoveFails(Move m)
           
protected  void assertDoMoveIsOk(Move m)
           
protected  void assertDoThenUndoLeavesWorldUnchanged(Move m)
           
protected  void assertOkAndRepeatable(Move m)
           
protected  void assertOkButNotRepeatable(Move m)
          Generally moves should not be repeatable.
private  void assertSetupHasBeenCalled()
           
protected  void assertSurvivesSerialisation(FreerailsSerializable m)
          This method asserts that if we serialise then deserialise the specified move, the specified move is equal to the deserialised move.
protected  void assertTrackHere(int x, int y)
           
protected  void assertTrackHere(PathOnTiles path)
           
protected  void assertTryMoveFails(Move m)
           
protected  void assertTryMoveIsOk(Move m)
           
protected  void assertTryUndoMoveFails(Move m)
           
protected  void assertTryUndoMoveIsOk(Move m)
           
protected  void assertUndoMoveFails(Move m)
           
protected  void assertUndoMoveIsOk(Move m)
           
(package private)  FreerailsPrincipal getPrincipal()
           
(package private)  World getWorld()
           
protected  boolean hasSetupBeenCalled()
           
protected  void setHasSetupBeenCalled(boolean hasSetupBeenCalled)
           
protected  void setUp()
           
protected  void setupWorld()
           
(package private)  void setWorld(World world)
           
 void testMove()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

hasSetupBeenCalled

private boolean hasSetupBeenCalled

world

protected World world
Constructor Detail

AbstractMoveTestCase

protected AbstractMoveTestCase()

AbstractMoveTestCase

public AbstractMoveTestCase(java.lang.String str)
Method Detail

assertDoMoveFails

protected void assertDoMoveFails(Move m)

assertDoMoveIsOk

protected void assertDoMoveIsOk(Move m)

assertDoThenUndoLeavesWorldUnchanged

protected void assertDoThenUndoLeavesWorldUnchanged(Move m)

assertSurvivesSerialisation

protected void assertSurvivesSerialisation(FreerailsSerializable m)
This method asserts that if we serialise then deserialise the specified move, the specified move is equal to the deserialised move. The assertion depends on the move being serialisable and the equals method being implemented correctly. Also checks that the hashcode does not change.

Parameters:
m -

assertOkAndRepeatable

protected void assertOkAndRepeatable(Move m)

assertOkButNotRepeatable

protected void assertOkButNotRepeatable(Move m)
Generally moves should not be repeatable. For example, if we have just removed a piece of track, that piece of track is gone, so we cannot remove it again.


assertSetupHasBeenCalled

private void assertSetupHasBeenCalled()

assertTryMoveFails

protected void assertTryMoveFails(Move m)

assertTryMoveIsOk

protected void assertTryMoveIsOk(Move m)

assertTryUndoMoveFails

protected void assertTryUndoMoveFails(Move m)

assertTryUndoMoveIsOk

protected void assertTryUndoMoveIsOk(Move m)

assertUndoMoveFails

protected void assertUndoMoveFails(Move m)

assertUndoMoveIsOk

protected void assertUndoMoveIsOk(Move m)

getPrincipal

FreerailsPrincipal getPrincipal()

getWorld

World getWorld()

hasSetupBeenCalled

protected boolean hasSetupBeenCalled()

setHasSetupBeenCalled

protected void setHasSetupBeenCalled(boolean hasSetupBeenCalled)

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

setupWorld

protected void setupWorld()

setWorld

void setWorld(World world)

testMove

public void testMove()

assertTrackHere

protected void assertTrackHere(int x,
                               int y)

assertTrackHere

protected void assertTrackHere(PathOnTiles path)