Commit 0a4266cb authored by Drahomír Karchňák's avatar Drahomír Karchňák

#366 Fixed tests. Added copyright where needed!

parent d2c37311
Subproject commit 49cb2f88656e05249f8dbb43c481e929cdb9ea1e
Subproject commit d789f13b16efb7f951a9787e5a5701530bbe158b
......@@ -150,6 +150,10 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
return startSoundName;
}
public GameResultDefinition getGameResultDefinition() {
return gameResultDefinition;
}
public static GameResult getGameResultForStartCount(int starCount) {
for (GameResult gameResult : GameResult.values()) {
if (gameResult.getStarCount() == starCount) {
......@@ -1381,7 +1385,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
}
private void forceGameEnd(GameResultDefinition gameResult) {
List<GameScore> gameScores = GameDefinition.getGameDefinitionForClass(getClass()).getGameResultResolver().getExampleScoreForGameResult(DifficultyDefinition.getDifficultyDefinitionForDifficultyNumber(getGameDifficulty().getDifficultyNumber()), gameResult);
List<GameScore> gameScores = GameDefinition.getGameDefinitionForClass(getClass()).getGameResultResolver().getExampleScoreForGameResult(getGameDifficulty().getDifficultyDefinition(), gameResult);
setGameScores(gameScores);
waitForActualGameScore();
......
......@@ -51,6 +51,10 @@ public enum GameDifficulty {
this.hasScore = hasScore;
}
public DifficultyDefinition getDifficultyDefinition() {
return difficultyDefinition;
}
public int getDifficultyNumber() {
return difficultyDefinition.number();
}
......
......@@ -35,6 +35,7 @@ import cz.nic.tablexia.screen.statistics.StatisticsGameScoreResolver;
import cz.nic.tablexia.shared.model.Game;
import cz.nic.tablexia.shared.model.GameScore;
import cz.nic.tablexia.shared.model.User;
import cz.nic.tablexia.shared.model.definitions.GenderDefinition;
/**
......@@ -46,7 +47,7 @@ public class AverageScoreTest {
@Before
public void tearUp() {
User user = new User(1, "name", 15, User.Gender.MALE, "avatar", "signature", false, false, false);
User user = new User(1, "name", 15, GenderDefinition.FEMALE, "avatar", "signature", false, false, false);
List<Game> games = new ArrayList<Game>();
String key = RobberyGame.SCORE_KEY_PERSON_NUMBER;
......
......@@ -33,6 +33,8 @@ import cz.nic.tablexia.game.ranksystem.UserRankManager;
import cz.nic.tablexia.shared.model.Game;
import cz.nic.tablexia.shared.model.GameScore;
import cz.nic.tablexia.shared.model.User;
import cz.nic.tablexia.shared.model.definitions.DifficultyDefinition;
import cz.nic.tablexia.shared.model.definitions.GenderDefinition;
/**
* Created by drahomir on 8/17/16.
......@@ -41,7 +43,7 @@ public class RankSystemTest {
private static long gameIdCounter = 0;
public static List<GameScore> getGameScoreList(GameDefinition gameDefinition, GameDifficulty gameDifficulty, AbstractTablexiaGame.GameResult gameResult) {
return gameDefinition.getGameResultResolver().getGameScoreList(gameDifficulty, gameResult);
return gameDefinition.getGameResultResolver().getExampleScoreForGameResult(gameDifficulty.getDifficultyDefinition(), gameResult.getGameResultDefinition());
}
public static Game createGame(User user, GameDefinition gameDefinition, GameDifficulty gameDifficulty, AbstractTablexiaGame.GameResult gameResult) {
......@@ -53,7 +55,7 @@ public class RankSystemTest {
@Test
public void test() {
User user = new User(0, "RankSystemTest", 21, User.Gender.FEMALE, null, null, false, false, false);
User user = new User(0, "RankSystemTest", 21, GenderDefinition.FEMALE, null, null, false, false, false);
UserRankManager.RankComputeData data = RankProcessingScript.calculateUsersRank(user, new RankProcessingScript.RankGamesRetriever() {
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment