diff --git a/community/solutions/TEMPLATE-[replace_with_your_name].md b/community/solutions/TEMPLATE-[replace_with_your_name].md deleted file mode 100644 index 87773ec..0000000 --- a/community/solutions/TEMPLATE-[replace_with_your_name].md +++ /dev/null @@ -1,12 +0,0 @@ -# Advent of Craft 2025 - -## Solution DAY NN - -- Contributor Discord Name : -- Stack : -- Fork : - -## More feedback to share (optional) - -- I loved the experience because: -- I found the exercise could be better if: diff --git a/community/solutions/emilybache.md b/community/solutions/emilybache.md new file mode 100644 index 0000000..24c4a31 --- /dev/null +++ b/community/solutions/emilybache.md @@ -0,0 +1,14 @@ +# Advent of Craft 2025 + +## Solution DAY 01 + +- Contributor Discord Name : emilybache +- Stack : Java, IntelliJ, Codescene +- Fork : https://github.com/emilybache/advent-of-craft-2025 + +## More feedback to share (optional) + +- I loved the experience because: +It gave me an excuse to try out Codescene + +- I found the exercise could be better if: diff --git a/memories/2023/exercise/java/day01/src/main/java/food/Food.java b/memories/2023/exercise/java/day01/src/main/java/food/Food.java index c1d03f2..29bd313 100644 --- a/memories/2023/exercise/java/day01/src/main/java/food/Food.java +++ b/memories/2023/exercise/java/day01/src/main/java/food/Food.java @@ -8,12 +8,9 @@ public record Food(LocalDate expirationDate, Boolean approvedForConsumption, UUID inspectorId) { public boolean isEdible(Supplier now) { - if (this.expirationDate.isAfter(now.get()) && + boolean isPastExpirationDate = this.expirationDate.isAfter(now.get()); + return isPastExpirationDate && this.approvedForConsumption && - this.inspectorId != null) { - return true; - } else { - return false; - } + this.inspectorId != null; } } \ No newline at end of file diff --git a/memories/2024/exercise/java/day01/src/main/java/communication/SantaCommunicator.java b/memories/2024/exercise/java/day01/src/main/java/communication/SantaCommunicator.java index 8aa41bb..6b3bfd3 100644 --- a/memories/2024/exercise/java/day01/src/main/java/communication/SantaCommunicator.java +++ b/memories/2024/exercise/java/day01/src/main/java/communication/SantaCommunicator.java @@ -2,9 +2,11 @@ public class SantaCommunicator { private final int numberOfDaysToRest; + private final Logger logger; - public SantaCommunicator(int numberOfDaysToRest) { + public SantaCommunicator(int numberOfDaysToRest, Logger logger) { this.numberOfDaysToRest = numberOfDaysToRest; + this.logger = logger; } public String composeMessage(String reindeerName, String currentLocation, int numbersOfDaysForComingBack, int numberOfDaysBeforeChristmas) { @@ -14,9 +16,9 @@ public String composeMessage(String reindeerName, String currentLocation, int nu " in " + daysBeforeReturn + " day(s) to be ready and rest before Christmas."; } - public boolean isOverdue(String reindeerName, String currentLocation, int numbersOfDaysForComingBack, int numberOfDaysBeforeChristmas, Logger logger) { + public boolean isOverdue(String reindeerName, String currentLocation, int numbersOfDaysForComingBack, int numberOfDaysBeforeChristmas) { if (daysBeforeReturn(numbersOfDaysForComingBack, numberOfDaysBeforeChristmas) <= 0) { - logger.log("Overdue for " + reindeerName + " located " + currentLocation + "."); + this.logger.log("Overdue for " + reindeerName + " located " + currentLocation + "."); return true; } return false; diff --git a/memories/2024/exercise/java/day01/src/test/java/SantaCommunicatorTest.java b/memories/2024/exercise/java/day01/src/test/java/SantaCommunicatorTest.java index 836ee48..d4e06a7 100644 --- a/memories/2024/exercise/java/day01/src/test/java/SantaCommunicatorTest.java +++ b/memories/2024/exercise/java/day01/src/test/java/SantaCommunicatorTest.java @@ -15,7 +15,7 @@ class SantaCommunicatorTest { @BeforeEach void setup() { - this.communicator = new SantaCommunicator(numberOfDaysToRest); + this.communicator = new SantaCommunicator(numberOfDaysToRest, logger); } @Test @@ -30,8 +30,8 @@ void shouldDetectOverdueReindeer() { DASHER, NORTH_POLE, numberOfDayBeforeChristmas, - numberOfDayBeforeChristmas, - logger); + numberOfDayBeforeChristmas + ); assertThat(overdue).isTrue(); assertThat(logger.getLog()) @@ -45,8 +45,8 @@ void shouldReturnFalseWhenNoOverdue() { DASHER, NORTH_POLE, numberOfDayBeforeChristmas - numberOfDaysToRest - 1, - numberOfDayBeforeChristmas, - logger) + numberOfDayBeforeChristmas + ) ).isFalse(); } } \ No newline at end of file