From bb84cf1754720866aca7b6854534fb1ec525acd2 Mon Sep 17 00:00:00 2001 From: JoaquimEsteves Date: Sun, 14 Jul 2024 05:22:02 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Closes=20#2796=20(#2821)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [no important files changed] --- .../src/test/java/NeedForSpeedTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exercises/concept/need-for-speed/src/test/java/NeedForSpeedTest.java b/exercises/concept/need-for-speed/src/test/java/NeedForSpeedTest.java index 70eea7999..f29eda17d 100644 --- a/exercises/concept/need-for-speed/src/test/java/NeedForSpeedTest.java +++ b/exercises/concept/need-for-speed/src/test/java/NeedForSpeedTest.java @@ -60,6 +60,17 @@ public void new_remote_control_car_battery_is_not_drained() { assertThat(car.batteryDrained()).isFalse(); } + @Test + @Tag("task:4") + @DisplayName("The batteryDrained method returns false when there's not enough battery") + public void new_remote_control_car_that_can_only_drive_once() { + var car = new NeedForSpeed(1, 99); + car.drive(); + assertThat(car.batteryDrained()).isTrue(); + // Ensure that the car was driven once + assertThat(car.distanceDriven()).isEqualTo(1); + } + @Test @Tag("task:4") @DisplayName("The batteryDrained method returns false when car battery did not completely drain after driving")