diff --git a/src/main/java/analyzer/exercises/needforspeed/NeedForSpeedAnalyzer.java b/src/main/java/analyzer/exercises/needforspeed/NeedForSpeedAnalyzer.java index 32f6a0d8..c2c4517e 100644 --- a/src/main/java/analyzer/exercises/needforspeed/NeedForSpeedAnalyzer.java +++ b/src/main/java/analyzer/exercises/needforspeed/NeedForSpeedAnalyzer.java @@ -62,7 +62,7 @@ class RaceTrackClassAnalyzer extends VoidVisitorAdapter { @Override public void visit(MethodDeclaration node, OutputCollector output) { - if (node.getNameAsString().equals("tryFinishTrack") && hasLoop(node)) { + if (node.getNameAsString().equals("canFinishRace") && hasLoop(node)) { output.addComment(new AvoidLoops()); } diff --git a/src/test/resources/scenarios/need-for-speed/ExemplarSolution.java b/src/test/resources/scenarios/need-for-speed/ExemplarSolution.java index 418db97e..9f94d36c 100644 --- a/src/test/resources/scenarios/need-for-speed/ExemplarSolution.java +++ b/src/test/resources/scenarios/need-for-speed/ExemplarSolution.java @@ -50,7 +50,7 @@ class RaceTrack { this.distance = distance; } - public boolean tryFinishTrack(NeedForSpeed car) { + public boolean canFinishRace(NeedForSpeed car) { return ((double) distance / car.getSpeed()) <= (car.getCurrentBattery() / car.getBatteryDrain()); } } diff --git a/src/test/resources/scenarios/need-for-speed/UsingForLoop.java b/src/test/resources/scenarios/need-for-speed/UsingForLoop.java index 5a91ea7f..4b6167f9 100644 --- a/src/test/resources/scenarios/need-for-speed/UsingForLoop.java +++ b/src/test/resources/scenarios/need-for-speed/UsingForLoop.java @@ -42,7 +42,7 @@ class RaceTrack { this.distance = distance; } - public boolean tryFinishTrack(NeedForSpeed car) { + public boolean canFinishRace(NeedForSpeed car) { for (int i = 0; i < this.distance / car.getSpeed(); i++) { car.drive(); } diff --git a/src/test/resources/scenarios/need-for-speed/UsingIfStatement.java b/src/test/resources/scenarios/need-for-speed/UsingIfStatement.java index 84f0f9d5..4b4aebf0 100644 --- a/src/test/resources/scenarios/need-for-speed/UsingIfStatement.java +++ b/src/test/resources/scenarios/need-for-speed/UsingIfStatement.java @@ -53,7 +53,7 @@ class RaceTrack { this.distance = distance; } - public boolean tryFinishTrack(NeedForSpeed car) { + public boolean canFinishRace(NeedForSpeed car) { return ((double) distance / car.getSpeed()) <= (car.getCurrentBattery() / car.getBatteryDrain()); } } diff --git a/src/test/resources/scenarios/need-for-speed/UsingTernary.java b/src/test/resources/scenarios/need-for-speed/UsingTernary.java index 441803df..2cb39674 100644 --- a/src/test/resources/scenarios/need-for-speed/UsingTernary.java +++ b/src/test/resources/scenarios/need-for-speed/UsingTernary.java @@ -50,7 +50,7 @@ class RaceTrack { this.distance = distance; } - public boolean tryFinishTrack(NeedForSpeed car) { + public boolean canFinishRace(NeedForSpeed car) { return ((double) distance / car.getSpeed()) <= (car.getCurrentBattery() / car.getBatteryDrain()); } } diff --git a/src/test/resources/scenarios/need-for-speed/UsingWhileLoop.java b/src/test/resources/scenarios/need-for-speed/UsingWhileLoop.java index 32c075bb..55116e48 100644 --- a/src/test/resources/scenarios/need-for-speed/UsingWhileLoop.java +++ b/src/test/resources/scenarios/need-for-speed/UsingWhileLoop.java @@ -38,7 +38,7 @@ class RaceTrack { this.distance = distance; } - public boolean tryFinishTrack(NeedForSpeed car) { + public boolean canFinishRace(NeedForSpeed car) { while (!car.batteryDrained()) { car.drive(); diff --git a/tests/need-for-speed/exemplar-solution/src/main/java/NeedForSpeed.java b/tests/need-for-speed/exemplar-solution/src/main/java/NeedForSpeed.java index 481e932a..f499e9fe 100644 --- a/tests/need-for-speed/exemplar-solution/src/main/java/NeedForSpeed.java +++ b/tests/need-for-speed/exemplar-solution/src/main/java/NeedForSpeed.java @@ -48,7 +48,7 @@ class RaceTrack { this.distance = distance; } - public boolean tryFinishTrack(NeedForSpeed car) { + public boolean canFinishRace(NeedForSpeed car) { return ((double) distance / car.getSpeed()) <= (car.getCurrentBattery() / car.getBatteryDrain()); } } diff --git a/tests/need-for-speed/using-if-statement/src/main/java/NeedForSpeed.java b/tests/need-for-speed/using-if-statement/src/main/java/NeedForSpeed.java index 772050df..4ad972a2 100644 --- a/tests/need-for-speed/using-if-statement/src/main/java/NeedForSpeed.java +++ b/tests/need-for-speed/using-if-statement/src/main/java/NeedForSpeed.java @@ -51,7 +51,7 @@ class RaceTrack { this.distance = distance; } - public boolean tryFinishTrack(NeedForSpeed car) { + public boolean canFinishRace(NeedForSpeed car) { return ((double) distance / car.getSpeed()) <= (car.getCurrentBattery() / car.getBatteryDrain()); } } diff --git a/tests/need-for-speed/using-while-loop/src/main/java/NeedForSpeed.java b/tests/need-for-speed/using-while-loop/src/main/java/NeedForSpeed.java index 226ee3f1..e73a22ad 100644 --- a/tests/need-for-speed/using-while-loop/src/main/java/NeedForSpeed.java +++ b/tests/need-for-speed/using-while-loop/src/main/java/NeedForSpeed.java @@ -36,7 +36,7 @@ class RaceTrack { this.distance = distance; } - public boolean tryFinishTrack(NeedForSpeed car) { + public boolean canFinishRace(NeedForSpeed car) { while (!car.batteryDrained()) { car.drive();