ctf.evaluation.simulator.setup
Class PlaceFlag

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by ctf.evaluation.TestCase
              extended by ctf.evaluation.simulator.setup.PlaceFlag
All Implemented Interfaces:
junit.framework.Test

public class PlaceFlag
extends TestCase

Tests the 'PlaceFlag' state


Constructor Summary
PlaceFlag()
           
 
Method Summary
protected  void place(Connection connection, double x, double y)
          Place a flag at an (x,y) location
protected  void place(Connection connection, Point point)
          Place a flag at a specific point
 void setUp()
          Get into the PlaceFlag state
 void tearDown()
          Tear down after a test
 void testBottomEdgeOfTheField()
          Flags may not be placed within 1m of the edge of the field
 void testCentreLine()
          Flags may not be placed within 1m of the centre line
 void testFlagOnEnemySide()
          A team may not place a flag on the opposing side of the field
 void testFlagPlayerDistance()
          Flags may not be placed within 25m of a player's starting position
 void testJail()
          A flag may not be placed with 1m of a jail
 void testLeftEdgeOfTheField()
          Flags may not be placed within 1m of the edge of the field
 void testNormalPlacement()
          Flags are placed in default locations
 void testRightEdgeOfTheField()
          Flags may not be placed within 1m of the edge of the field
 void testTopEdgeOfTheField()
          Flags may not be placed within 1m of the edge of the field
 void testUnplacedFlag()
          If a team's flag has not been placed, the other team should still be able to poll for the current game state; the game time will just be 0.
 
Methods inherited from class ctf.evaluation.TestCase
assertClose, assertClose, assertClose, assertClose, assertClose, assertClose, assertClose, assertCloseAbsolute, sleep
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlaceFlag

public PlaceFlag()
Method Detail

setUp

public void setUp()
           throws java.io.IOException,
                  NetworkException,
                  ProtocolError
Get into the PlaceFlag state

Overrides:
setUp in class TestCase
Throws:
java.io.IOException
NetworkException
ProtocolError

tearDown

public void tearDown()
Tear down after a test

Overrides:
tearDown in class TestCase

testNormalPlacement

public void testNormalPlacement()
                         throws java.io.IOException,
                                NetworkException,
                                ProtocolError,
                                RoundOverException,
                                GameOverException
Flags are placed in default locations

Throws:
java.io.IOException
NetworkException
ProtocolError
RoundOverException
GameOverException

testUnplacedFlag

public void testUnplacedFlag()
                      throws java.io.IOException,
                             NetworkException,
                             ProtocolError,
                             RoundOverException,
                             GameOverException
If a team's flag has not been placed, the other team should still be able to poll for the current game state; the game time will just be 0.

Throws:
java.io.IOException
NetworkException
ProtocolError
RoundOverException
GameOverException

testLeftEdgeOfTheField

public void testLeftEdgeOfTheField()
                            throws java.io.IOException,
                                   NetworkException,
                                   ProtocolError
Flags may not be placed within 1m of the edge of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testBottomEdgeOfTheField

public void testBottomEdgeOfTheField()
                              throws java.io.IOException,
                                     NetworkException,
                                     ProtocolError
Flags may not be placed within 1m of the edge of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testTopEdgeOfTheField

public void testTopEdgeOfTheField()
                           throws java.io.IOException,
                                  NetworkException,
                                  ProtocolError
Flags may not be placed within 1m of the edge of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testRightEdgeOfTheField

public void testRightEdgeOfTheField()
                             throws java.io.IOException,
                                    NetworkException,
                                    ProtocolError
Flags may not be placed within 1m of the edge of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testCentreLine

public void testCentreLine()
                    throws java.io.IOException,
                           NetworkException,
                           ProtocolError
Flags may not be placed within 1m of the centre line

Throws:
java.io.IOException
NetworkException
ProtocolError

testFlagPlayerDistance

public void testFlagPlayerDistance()
                            throws java.io.IOException,
                                   NetworkException,
                                   ProtocolError
Flags may not be placed within 25m of a player's starting position

Throws:
java.io.IOException
NetworkException
ProtocolError

testFlagOnEnemySide

public void testFlagOnEnemySide()
                         throws java.io.IOException,
                                NetworkException,
                                ProtocolError
A team may not place a flag on the opposing side of the field

Throws:
java.io.IOException
NetworkException
ProtocolError

testJail

public void testJail()
              throws java.io.IOException,
                     NetworkException,
                     ProtocolError
A flag may not be placed with 1m of a jail

Throws:
java.io.IOException
NetworkException
ProtocolError

place

protected void place(Connection connection,
                     Point point)
              throws java.io.IOException,
                     NetworkException
Place a flag at a specific point

Throws:
java.io.IOException
NetworkException

place

protected void place(Connection connection,
                     double x,
                     double y)
              throws java.io.IOException,
                     NetworkException
Place a flag at an (x,y) location

Throws:
java.io.IOException
NetworkException