Package test.comm

Source Code of test.comm.BroadcastCommunicatorTest

package test.comm;
import net.sf.nebulacards.comm.*;
import net.sf.nebulacards.game.*;
import net.sf.nebulacards.main.*;
import net.sf.nebulacards.util.*;
import net.sf.nebulacards.util.proc.*;
import junit.framework.*;
import OneProcGame;
import CountingUI;
import Utility;

public class BroadcastCommunicatorTest
  extends TestCase
{
  OneProcGame opg;
  BroadcastCommunicator bc;
  CountingUI[] targets;

  public BroadcastCommunicatorTest(String s) { super(s); }


  public void setUp()
  {
    opg = new OneProcGame("BroadcastCommunicator Test", 2);
    bc = new BroadcastCommunicator(opg);
    targets = new CountingUI[2];
    for (int i = 0; i < targets.length; i++)
    {
      final ComManager.AddResult cmar = opg.add(
              targets[i] = new CountingUI()
              );
      cmar.publicize();
    }
  }

  public void testRun()
      throws InterruptedException
  {
    for (int i = 0; i < 2; i++)
    {
      PlayingCard card = new PlayingCard(i, i);
      PileOfCards pile = new PileOfCards();
      pile.add(card);
      GameResult gr = new GameResult();
      gr.winners = new int[1]; gr.done = false;
      Utility.callAllMethods(bc, card, pile, gr, "Misc", opg.getPlayers());
      for (int j = 0; j < targets.length; j++)
      {
        assertEquals(targets[j].acceptedCount, i + 1);
        assertEquals(targets[j].bootedCount, i + 1);
        assertEquals(targets[j].cardToTableauCount, i + 1);
        assertEquals(targets[j].chatCount, i + 1);
        assertEquals(targets[j].clearTableauCount, i + 1);
        assertEquals(targets[j].dealHandCount, i + 1);
        assertEquals(targets[j].endGameCount, i + 1);
        assertEquals(targets[j].endHandCount, i + 1);
        assertEquals(targets[j].miscInfoCount, i + 1);
        assertEquals(targets[j].playedSoFarCount, i + 1);
        assertEquals(targets[j].rejectedCount, i + 1);
        assertEquals(targets[j].respondCount, i + 1);
        assertEquals(targets[j].setBidCount, i + 1);
        assertEquals(targets[j].setGameNameCount, i + 1);
        assertEquals(targets[j].setPlayersCount, i + 1);
        assertEquals(targets[j].setTrumpCount, i + 1);
        assertEquals(targets[j].yourTurnCount, i + 1);
        assertEquals(targets[j].yourTurnToBidCount, i + 1);
        assertEquals(targets[j].yourTurnToPassCount, i + 1);
      }
    }
  }
}
TOP

Related Classes of test.comm.BroadcastCommunicatorTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.