コード例 #1
0
  @Test
  public void testRelieveIntensiveCheckConditionWithModerate()
      throws InvalidMoveException, JMSException {
    game.setMode(Mode.SILVO_PUZZLE);
    ManantialesFicha contig1 =
        new ManantialesFicha(5, 4, alice.getColor(), TokenType.INTENSIVE_PASTURE);
    ManantialesFicha contig2 =
        new ManantialesFicha(6, 4, alice.getColor(), TokenType.INTENSIVE_PASTURE);
    SetIds(contig1, contig2);
    GameGrid grid = game.getGrid();
    if (grid.isEmpty()) grid.setCells(new HashSet<GridCell>());
    game.getGrid().getCells().add(contig1);
    ManantialesMove move = new ManantialesMove(alice, contig2);
    game.move(move);
    assertEquals(MoveStatus.EVALUATED, move.getStatus());
    assertEquals(1, game.getCheckConditions().size());
    List<Message> messages = filterForEvent(GameEvent.CONDITION_RAISED);
    assertEquals(1, messages.size());

    alice.setTurn(true);
    ManantialesFicha relief =
        new ManantialesFicha(5, 4, alice.getColor(), TokenType.MODERATE_PASTURE);
    move = new ManantialesMove(alice, contig1, relief);
    game.move(move);
    assertEquals(MoveStatus.EVALUATED, move.getStatus());
    assertEquals(
        Arrays.toString(game.getCheckConditions().toArray()), 0, game.getCheckConditions().size());
    messages = filterForEvent(GameEvent.CONDITION_RESOLVED);
    assertEquals(1, messages.size());
  }
コード例 #2
0
  @Before
  public void setUp() throws Exception {
    super.setUp();
    /* Set up mock JMS destination for message sender */
    ejbModule = createEJBTestModule();
    ejbModule.bindToContext(
        "MultiGameConnectionFactory", getJMSMockObjectFactory().getMockTopicConnectionFactory());
    mockTopic = getDestinationManager().createTopic("MultiGame");
    ejbModule.bindToContext("MultiGame", mockTopic);

    game = new ManantialesGame();
    game.setMode(Mode.COMPETITIVE);
    alice = (ManantialesPlayer) game.registerPlayer(new GridRegistrant("alice"));
    bob = (ManantialesPlayer) game.registerPlayer(new GridRegistrant("bob"));
    charlie = (ManantialesPlayer) game.registerPlayer(new GridRegistrant("charlie"));
    denise = (ManantialesPlayer) game.registerPlayer(new GridRegistrant("denise"));
  }