Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions exercises/practice/tournament/src/test/java/TournamentTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -14,13 +15,15 @@ public void setUp() {
}

@Test
@DisplayName("just the header if no input")
public void justTheHeaderIfNoInput() {
assertThat(tournament.printTable())
.isEqualTo("Team | MP | W | D | L | P\n");
}

@Disabled("Remove to run test")
@Test
@DisplayName("a win is three points, a loss is zero points")
public void aWinIsThreePointsALossIsZeroPoints() {
tournament.applyResults("Allegoric Alaskans;Blithering Badgers;win");
assertThat(tournament.printTable())
Expand All @@ -32,6 +35,7 @@ public void aWinIsThreePointsALossIsZeroPoints() {

@Disabled("Remove to run test")
@Test
@DisplayName("a win can also be expressed as a loss")
public void aWinCanAlsoBeExpressedAsALoss() {
tournament.applyResults("Blithering Badgers;Allegoric Alaskans;loss");
assertThat(tournament.printTable())
Expand All @@ -43,6 +47,7 @@ public void aWinCanAlsoBeExpressedAsALoss() {

@Disabled("Remove to run test")
@Test
@DisplayName("a different team can win")
public void aDifferentTeamCanWin() {
tournament.applyResults("Blithering Badgers;Allegoric Alaskans;win");
assertThat(tournament.printTable())
Expand All @@ -54,6 +59,7 @@ public void aDifferentTeamCanWin() {

@Disabled("Remove to run test")
@Test
@DisplayName("a draw is one point each")
public void aDrawIsOnePointEach() {
tournament.applyResults("Allegoric Alaskans;Blithering Badgers;draw");
assertThat(tournament.printTable())
Expand All @@ -65,6 +71,7 @@ public void aDrawIsOnePointEach() {

@Disabled("Remove to run test")
@Test
@DisplayName("There can be more than one match")
public void thereCanBeMoreThanOneMatch() {
tournament.applyResults(
"Allegoric Alaskans;Blithering Badgers;win\n" +
Expand All @@ -78,6 +85,7 @@ public void thereCanBeMoreThanOneMatch() {

@Disabled("Remove to run test")
@Test
@DisplayName("There can be more than one winner")
public void thereCanBeMoreThanOneWinner() {
tournament.applyResults(
"Allegoric Alaskans;Blithering Badgers;loss\n" +
Expand All @@ -91,6 +99,7 @@ public void thereCanBeMoreThanOneWinner() {

@Disabled("Remove to run test")
@Test
@DisplayName("There can be more than two teams")
public void thereCanBeMoreThanTwoTeams() {
tournament.applyResults(
"Allegoric Alaskans;Blithering Badgers;win\n" +
Expand All @@ -106,6 +115,7 @@ public void thereCanBeMoreThanTwoTeams() {

@Disabled("Remove to run test")
@Test
@DisplayName("typical input")
public void typicalInput() {
tournament.applyResults(
"Allegoric Alaskans;Blithering Badgers;win\n" +
Expand All @@ -125,6 +135,7 @@ public void typicalInput() {

@Disabled("Remove to run test")
@Test
@DisplayName("incomplete competition (not all pairs have played)")
public void incompleteCompetition() {
tournament.applyResults(
"Allegoric Alaskans;Blithering Badgers;loss\n" +
Expand All @@ -142,6 +153,7 @@ public void incompleteCompetition() {

@Disabled("Remove to run test")
@Test
@DisplayName("ties broken alphabetically")
public void tiesBrokenAlphabetically() {
tournament.applyResults(
"Courageous Californians;Devastating Donkeys;win\n" +
Expand All @@ -161,6 +173,7 @@ public void tiesBrokenAlphabetically() {

@Disabled("Remove to run test")
@Test
@DisplayName("ensure points sorted numerically")
public void pointsSortedNumerically() {
tournament.applyResults(
"Devastating Donkeys;Blithering Badgers;win\n" +
Expand Down