From d75880b16bf3a14383693a4e0ad792549d117a5b Mon Sep 17 00:00:00 2001 From: Jorge Date: Mon, 22 Sep 2025 17:57:36 +0200 Subject: [PATCH 1/6] feat(FootBallMatchReportsTest.java): test for unknown returns --- .../src/test/java/FootballMatchReportsTest.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java b/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java index aeaeada1d..f1867caac 100644 --- a/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java +++ b/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java @@ -68,17 +68,15 @@ public void test_right_wing() { @Test @Tag("task:2") - @DisplayName("The onField method throws IllegalArgumentException for unknown shirt number") + @DisplayName("The onField method returns 'unknown' for unknown shirt number") public void test_exception() { - assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy(() -> FootballMatchReports.onField(13)); + assertThat(FootballMatchReports.onField(13)).isEqualTo("unknown"); } @Test @Tag("task:2") - @DisplayName("The onField method throws IllegalArgumentException for negative shirt number") + @DisplayName("The onField method returns 'unknown' for negative shirt number") public void test_exception_negative_number() { - assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy(() -> FootballMatchReports.onField(-1)); + assertThat(FootballMatchReports.onField(-1)).isEqualTo("unknown"); } } From 74225e58cc4ce85aa13e732e10a6d687b7710f9c Mon Sep 17 00:00:00 2001 From: Jorge Date: Mon, 22 Sep 2025 17:58:05 +0200 Subject: [PATCH 2/6] docs(football-match-reports/meta/instructions): change exception instruction to default instruction --- .../concept/football-match-reports/.docs/instructions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/concept/football-match-reports/.docs/instructions.md b/exercises/concept/football-match-reports/.docs/instructions.md index f255c3a13..45855814c 100644 --- a/exercises/concept/football-match-reports/.docs/instructions.md +++ b/exercises/concept/football-match-reports/.docs/instructions.md @@ -27,11 +27,11 @@ FootballMatchReports.onField(10); // => "striker" ``` -## 2. Raise an alert if an unknown shirt number is encountered +## 2. Output "unknown" if the shirt number is not part of the official list -Modify the `FootballMatchReports.onField()` method to throw an `IllegalArgumentException` when a shirt number outside the range 1-11 is processed. +Modify the `FootballMatchReports.onField()` method to return 'unknown' when a shirt number outside the range 1-11 is processed. ```java FootballMatchReports.onField(13); -// => Throw IllegalArgumentException +// => "unknown" ``` From e2c8bb01b46a59b79ab3e9a73977561af545bf68 Mon Sep 17 00:00:00 2001 From: Jorge Date: Mon, 22 Sep 2025 17:58:22 +0200 Subject: [PATCH 3/6] fix(FootBallMatchReportsTest.java): remove unused import --- .../src/test/java/FootballMatchReportsTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java b/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java index f1867caac..28bd35ee8 100644 --- a/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java +++ b/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java @@ -3,7 +3,6 @@ import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; public class FootballMatchReportsTest { From b502140a909eaca604771cfb0ea80b1cd7dad4ec Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 23 Sep 2025 09:22:47 +0200 Subject: [PATCH 4/6] update example solution --- .../.meta/src/reference/java/FootballMatchReports.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/concept/football-match-reports/.meta/src/reference/java/FootballMatchReports.java b/exercises/concept/football-match-reports/.meta/src/reference/java/FootballMatchReports.java index d18f55ac6..c2a63b424 100644 --- a/exercises/concept/football-match-reports/.meta/src/reference/java/FootballMatchReports.java +++ b/exercises/concept/football-match-reports/.meta/src/reference/java/FootballMatchReports.java @@ -30,7 +30,7 @@ public static String onField(int shirtNum) { playerDescription = "striker"; break; default: - throw new IllegalArgumentException(); + playerDescription = "unknown"; } return playerDescription; } From cfd655d13f7e2e5383d3f015d7c5df2f3b92d94b Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 23 Sep 2025 09:26:40 +0200 Subject: [PATCH 5/6] use "invalid" instead of "unknown" --- .../concept/football-match-reports/.docs/instructions.md | 6 +++--- .../.meta/src/reference/java/FootballMatchReports.java | 2 +- .../src/test/java/FootballMatchReportsTest.java | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/exercises/concept/football-match-reports/.docs/instructions.md b/exercises/concept/football-match-reports/.docs/instructions.md index 45855814c..2c668b663 100644 --- a/exercises/concept/football-match-reports/.docs/instructions.md +++ b/exercises/concept/football-match-reports/.docs/instructions.md @@ -27,11 +27,11 @@ FootballMatchReports.onField(10); // => "striker" ``` -## 2. Output "unknown" if the shirt number is not part of the official list +## 2. Output "invalid" if the shirt number is not part of the official list -Modify the `FootballMatchReports.onField()` method to return 'unknown' when a shirt number outside the range 1-11 is processed. +Modify the `FootballMatchReports.onField()` method to return 'invalid' when a shirt number outside the range 1-11 is processed. ```java FootballMatchReports.onField(13); -// => "unknown" +// => "invalid" ``` diff --git a/exercises/concept/football-match-reports/.meta/src/reference/java/FootballMatchReports.java b/exercises/concept/football-match-reports/.meta/src/reference/java/FootballMatchReports.java index c2a63b424..c99abc7b0 100644 --- a/exercises/concept/football-match-reports/.meta/src/reference/java/FootballMatchReports.java +++ b/exercises/concept/football-match-reports/.meta/src/reference/java/FootballMatchReports.java @@ -30,7 +30,7 @@ public static String onField(int shirtNum) { playerDescription = "striker"; break; default: - playerDescription = "unknown"; + playerDescription = "invalid"; } return playerDescription; } diff --git a/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java b/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java index 28bd35ee8..7c45eb1a7 100644 --- a/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java +++ b/exercises/concept/football-match-reports/src/test/java/FootballMatchReportsTest.java @@ -67,15 +67,15 @@ public void test_right_wing() { @Test @Tag("task:2") - @DisplayName("The onField method returns 'unknown' for unknown shirt number") + @DisplayName("The onField method returns 'invalid' for invalid shirt number") public void test_exception() { - assertThat(FootballMatchReports.onField(13)).isEqualTo("unknown"); + assertThat(FootballMatchReports.onField(13)).isEqualTo("invalid"); } @Test @Tag("task:2") - @DisplayName("The onField method returns 'unknown' for negative shirt number") + @DisplayName("The onField method returns 'invalid' for negative shirt number") public void test_exception_negative_number() { - assertThat(FootballMatchReports.onField(-1)).isEqualTo("unknown"); + assertThat(FootballMatchReports.onField(-1)).isEqualTo("invalid"); } } From e8d09d6661573351629a0e5cfb9616a39bde0e82 Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 23 Sep 2025 09:29:08 +0200 Subject: [PATCH 6/6] add contributor --- exercises/concept/football-match-reports/.meta/config.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exercises/concept/football-match-reports/.meta/config.json b/exercises/concept/football-match-reports/.meta/config.json index 9b291514e..74d3894b7 100644 --- a/exercises/concept/football-match-reports/.meta/config.json +++ b/exercises/concept/football-match-reports/.meta/config.json @@ -2,6 +2,9 @@ "authors": [ "Azumix" ], + "contributors": [ + "AlvesJorge" + ], "files": { "solution": [ "src/main/java/FootballMatchReports.java"