|
| 1 | +import java.util.Arrays; |
| 2 | +import org.junit.Test; |
| 3 | + |
| 4 | +import static org.assertj.core.api.Assertions.assertThat; |
| 5 | + |
| 6 | +public class HighScoresTest { |
| 7 | + |
| 8 | + @Test |
| 9 | + public void shouldReturnListOfScores() { |
| 10 | + HighScores highScores = new HighScores(Arrays.asList(30, 50, 20, 70)); |
| 11 | + assertThat(Arrays.asList(30, 50, 20, 70)).isEqualTo(highScores.scores()); |
| 12 | + } |
| 13 | + |
| 14 | + @Test |
| 15 | + @Ignore("Remove to run test") |
| 16 | + public void shouldReturnLatestAddedScore() { |
| 17 | + HighScores highScores = new HighScores(Arrays.asList(100, 0, 90, 30)); |
| 18 | + assertThat(30).isEqualTo(highScores.latest()); |
| 19 | + } |
| 20 | + |
| 21 | + @Test |
| 22 | + @Ignore("Remove to run test") |
| 23 | + public void shouldReturnPersonalBest() { |
| 24 | + HighScores highScores = new HighScores(Arrays.asList(40, 100, 70)); |
| 25 | + assertThat(100).isEqualTo(highScores.personalBest()); |
| 26 | + } |
| 27 | + |
| 28 | + @Test |
| 29 | + @Ignore("Remove to run test") |
| 30 | + public void shouldReturnPersonalTopThreeFromListOfScores() { |
| 31 | + HighScores highScores = new HighScores(Arrays.asList(10, 30, 90, 30, 100, 20, 10, 0, 30, 40, 40, 70, 70)); |
| 32 | + assertThat(Arrays.asList(100, 90, 70)).isEqualTo(highScores.personalTopThree()); |
| 33 | + } |
| 34 | + |
| 35 | + @Test |
| 36 | + @Ignore("Remove to run test") |
| 37 | + public void shouldReturnPersonalTopThreeSortedHighestToLowest() { |
| 38 | + HighScores highScores = new HighScores(Arrays.asList(20, 10, 30)); |
| 39 | + assertThat(Arrays.asList(30, 20, 10)).isEqualTo(highScores.personalTopThree()); |
| 40 | + } |
| 41 | + |
| 42 | + @Test |
| 43 | + @Ignore("Remove to run test") |
| 44 | + public void shouldReturnPersonalTopThreeWhenThereIsATie() { |
| 45 | + HighScores highScores = new HighScores(Arrays.asList(40, 20, 40, 30)); |
| 46 | + assertThat(Arrays.asList(40, 40, 30)).isEqualTo(highScores.personalTopThree()); |
| 47 | + } |
| 48 | + |
| 49 | + @Test |
| 50 | + @Ignore("Remove to run test") |
| 51 | + public void shouldReturnPersonalTopWhenThereIsLessThanThreeScores() { |
| 52 | + HighScores highScores = new HighScores(Arrays.asList(30, 70)); |
| 53 | + assertThat(Arrays.asList(70, 30)).isEqualTo(highScores.personalTopThree()); |
| 54 | + } |
| 55 | + |
| 56 | + @Test |
| 57 | + @Ignore("Remove to run test") |
| 58 | + public void shouldReturnPersonalTopWhenThereIsOnlyOneScore() { |
| 59 | + HighScores highScores = new HighScores(Arrays.asList(40)); |
| 60 | + assertThat(Arrays.asList(40)).isEqualTo(highScores.personalTopThree()); |
| 61 | + } |
| 62 | + |
| 63 | + @Test |
| 64 | + @Ignore("Remove to run test") |
| 65 | + public void callingLatestAfterPersonalTopThree() { |
| 66 | + HighScores highScores = new HighScores(Arrays.asList(70, 50, 20, 30)); |
| 67 | + highScores.personalTopThree(); |
| 68 | + assertThat(30).isEqualTo(highScores.latest()); |
| 69 | + } |
| 70 | + |
| 71 | + @Test |
| 72 | + @Ignore("Remove to run test") |
| 73 | + public void callingScoresAfterPersonalTopThree() { |
| 74 | + HighScores highScores = new HighScores(Arrays.asList(30, 50, 20, 70)); |
| 75 | + highScores.personalTopThree(); |
| 76 | + assertThat(Arrays.asList(30, 50, 20, 70)).isEqualTo(highScores.scores()); |
| 77 | + } |
| 78 | + |
| 79 | + @Test |
| 80 | + @Ignore("Remove to run test") |
| 81 | + public void callingLatestAfterPersonalBest() { |
| 82 | + HighScores highScores = new HighScores(Arrays.asList(20, 70, 15, 25, 30)); |
| 83 | + highScores.personalBest(); |
| 84 | + assertThat(30).isEqualTo(highScores.latest()); |
| 85 | + } |
| 86 | + |
| 87 | + @Test |
| 88 | + @Ignore("Remove to run test") |
| 89 | + public void callingScoresAfterPersonalBest() { |
| 90 | + HighScores highScores = new HighScores(Arrays.asList(20, 70, 15, 25, 30)); |
| 91 | + highScores.personalBest(); |
| 92 | + assertThat(Arrays.asList(20, 70, 15, 25, 30)).isEqualTo(highScores.scores()); |
| 93 | + } |
| 94 | +} |
0 commit comments