Package com.antonytrupe.server.battledisks

Source Code of com.antonytrupe.server.battledisks.APITest

package com.antonytrupe.server.battledisks;

import org.junit.Test;
import org.mozilla.javascript.ScriptableObject;

import com.antonytrupe.server.GAETestCase;
import com.antonytrupe.server.games.GameEngineException;

public class APITest extends GAETestCase {

  @Test
  public void updateRankings() throws GameEngineException {
    API api = new API();
    ScriptableObject table = api.createTable("2", "50", "3", "6", "6",
        "neutral allowed", "annihilation");

    api.join(
        table,
        api.createPlayer("test3@example.com"),
        "[{\"name\":\"Heavy Horse Cavalry\",\"attack\":\"6\",\"defense\":\"3\",\"toughness\":\"4\",\"movement\":\"5\",\"wounds\":\"1\",\"flying\":\"false\",\"cost\":\"8\",\"faction\":\"Knight\",\"alignment\":\"Good\",\"diameter\":\"2.5\",\"description\":\"\",\"price\":\"0.20\"},{\"name\":\"Heavy Horse Cavalry\",\"attack\":\"6\",\"defense\":\"3\",\"toughness\":\"4\",\"movement\":\"5\",\"wounds\":\"1\",\"flying\":\"false\",\"cost\":\"8\",\"faction\":\"Knight\",\"alignment\":\"Good\",\"diameter\":\"2.5\",\"description\":\"\",\"price\":\"0.20\"},{\"name\":\"Heavy Horse Cavalry\",\"attack\":\"6\",\"defense\":\"3\",\"toughness\":\"4\",\"movement\":\"5\",\"wounds\":\"1\",\"flying\":\"false\",\"cost\":\"8\",\"faction\":\"Knight\",\"alignment\":\"Good\",\"diameter\":\"2.5\",\"description\":\"\",\"price\":\"0.20\"}]");
    api.join(
        table,
        api.createPlayer("test2@example.com"),
        "[{\"name\":\"Dragonflight\",\"attack\":\"3\",\"defense\":\"3\",\"toughness\":\"4\",\"movement\":\"6\",\"wounds\":\"1\",\"flying\":\"false\",\"cost\":\"5\",\"faction\":\"Dragon\",\"alignment\":\"Evil\",\"diameter\":\"2\",\"description\":\"\",\"price\":\"0.44999999999999996\"},{\"name\":\"Dragonflight\",\"attack\":\"3\",\"defense\":\"3\",\"toughness\":\"4\",\"movement\":\"6\",\"wounds\":\"1\",\"flying\":\"false\",\"cost\":\"5\",\"faction\":\"Dragon\",\"alignment\":\"Evil\",\"diameter\":\"2\",\"description\":\"\",\"price\":\"0.44999999999999996\"},{\"name\":\"Dragonflight\",\"attack\":\"3\",\"defense\":\"3\",\"toughness\":\"4\",\"movement\":\"6\",\"wounds\":\"1\",\"flying\":\"false\",\"cost\":\"5\",\"faction\":\"Dragon\",\"alignment\":\"Evil\",\"diameter\":\"2\",\"description\":\"\",\"price\":\"0.44999999999999996\"}]");

    api.updateRatings(table);
  }

  @Test
  public void testAPI() throws GameEngineException {
    API api = new API();
    @SuppressWarnings("unused")
    ScriptableObject table = api.createTable("2", "50", "3", "6", "6",
        "neutral allowed", "annihilation");
  }

  @Test(expected = GameEngineException.class)
  public void testException() throws GameEngineException {
    throw new GameEngineException(null);
  }
}
TOP

Related Classes of com.antonytrupe.server.battledisks.APITest

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.