package hu.unideb.inf.Dao;

/**
 * Created by MJ on 2017. 05. 31..
 */
public class HighScores {
}

@@ -25,75 +25,1956 @@
 o;%0A%0A
-/**%0A * Created by MJ on 2017. 05. 31..%0A */%0Apublic class HighScores %7B
+import org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collections;%0A%0Aimport static org.junit.Assert.*;%0A%0Apublic class HighScoresTest %7B%0A    private HighScores highScores;%0A%0A    @Before%0A    public void setHighScores()%7B%0A        highScores = new HighScores();%0A    %7D%0A%0A    @Test%0A    public void getHighScoreTest()%7B%0A        ArrayList%3CHighScore%3E highScoresList  = new ArrayList%3CHighScore%3E();%0A        assertArrayEquals(highScoresList.toArray(),highScores.getHighScore().toArray());%0A    %7D%0A%0A    @Test%0A    public void setHighScoreTest()%7B%0A        ArrayList%3CHighScore%3E highScoresList  = new ArrayList%3CHighScore%3E();%0A        highScoresList.add(new HighScore(%22Player1%22,%2210%22,%222017-01-01%22));%0A        highScoresList.add(new HighScore(%22Player2%22,%2220%22,%222017-02-02%22));%0A        highScoresList.add(new HighScore(%22Player3%22,%2230%22,%222017-03-03%22));%0A        highScoresList.add(new HighScore(%22Player4%22,%2240%22,%222017-04-04%22));%0A        highScoresList.add(new HighScore(%22Player5%22,%2250%22,%222017-05-05%22));%0A        highScoresList.add(new HighScore(%22Player6%22,%2260%22,%222017-06-06%22));%0A        highScores.setHighScore(highScoresList);%0A%0A        Collections.sort(highScoresList, (hs1, hs2) -%3E %7B%0A            return Integer.parseInt(hs2.getScore()) - Integer.parseInt(hs1.getScore());%0A        %7D);%0A%0A        if (highScoresList.size() %3E 5)%7B%0A            for (int i = 0; i %3C highScoresList.size(); i++) %7B%0A                highScoresList.subList(5, highScoresList.size()).clear();%0A            %7D%0A        %7D%0A%0A        assertArrayEquals(highScoresList.toArray(),highScores.getHighScore().toArray());%0A    %7D%0A%0A%0A    @Test%0A    public void addHighScoreTest()%7B%0A        HighScore highScore = new HighScore(%22Player%22,%2210%22,%221999-01-11%22);%0A        highScores.addHighScore(highScore);%0A%0A        ArrayList%3CHighScore%3E highScoresList  = new ArrayList%3CHighScore%3E();%0A        highScoresList.add(highScore);%0A%0A        assertArrayEquals(highScoresList.toArray(),highScores.getHighScore().toArray());%0A    %7D
 %0A%7D%0A

Add HighscoresTest