com.bolinfest.prisonerbot
Class ManagerTest

java.lang.Object
  extended by TestCase
      extended by com.bolinfest.prisonerbot.ManagerTest

public class ManagerTest
extends TestCase

ManagerTest is a JUnit test of the Manager interface.

Author:
mbolin

Nested Class Summary
protected static class ManagerTest.NullProxy
          NullProxy is a MessageProxy that simulates sending messages online.
 
Field Summary
protected  Buddy b1
           
protected static String B1
           
protected  Buddy b2
           
protected static String B2
           
protected  Manager mgr
           
protected static String[] NAMES
           
protected static String NO
           
protected static String YES
           
 
Constructor Summary
ManagerTest()
           
 
Method Summary
protected static Buddy createBuddy(String name, Manager mgr, ManagerTest.NullProxy proxy)
           
protected static boolean msgContains(String longMessage, String subMessage)
           
protected static void sendChoices(Buddy b1, Buddy b2, Choice c1, Choice c2)
           
protected  void setUp()
          Create a Manager to test and some Players
protected  void tearDown()
           
 void testFourRoundGame()
           
 void testOnePlayerNoGame()
          Makes sure one player can: chat with the manager get help refuse a game
 void testOnePlayerWaitGame()
          Tests that two players can introduce themselves to the bot and start to negotiate the number of rounds.
 void testPlayerNegotiatingRounds()
          Players should be able to negotiate rounds and the Manager should be able to handle erroneous input
 void testStripHtml()
           
 void testZeroPlayers()
          Make sure manager is initialized correctly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mgr

protected Manager mgr

b1

protected Buddy b1

b2

protected Buddy b2

B1

protected static final String B1
See Also:
Constant Field Values

B2

protected static final String B2
See Also:
Constant Field Values

NAMES

protected static String[] NAMES

YES

protected static final String YES
See Also:
Constant Field Values

NO

protected static final String NO
See Also:
Constant Field Values
Constructor Detail

ManagerTest

public ManagerTest()
Method Detail

setUp

protected void setUp()
              throws Exception
Create a Manager to test and some Players

Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Throws:
Exception

createBuddy

protected static Buddy createBuddy(String name,
                                   Manager mgr,
                                   ManagerTest.NullProxy proxy)

testStripHtml

public void testStripHtml()

testZeroPlayers

public void testZeroPlayers()
Make sure manager is initialized correctly.


testOnePlayerNoGame

public void testOnePlayerNoGame()
Makes sure one player can:


testOnePlayerWaitGame

public void testOnePlayerWaitGame()
Tests that two players can introduce themselves to the bot and start to negotiate the number of rounds.


testPlayerNegotiatingRounds

public void testPlayerNegotiatingRounds()
Players should be able to negotiate rounds and the Manager should be able to handle erroneous input


testFourRoundGame

public void testFourRoundGame()

sendChoices

protected static void sendChoices(Buddy b1,
                                  Buddy b2,
                                  Choice c1,
                                  Choice c2)

msgContains

protected static boolean msgContains(String longMessage,
                                     String subMessage)
Returns:
true if the subMessage is contained within the longMessage