From c26e64ec36cfdd77691a8ace0ea7da6c593e5843 Mon Sep 17 00:00:00 2001 From: Joaquim Esteves Date: Sat, 13 Jul 2024 17:53:41 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Closes=20#2796?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../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")