Merge remote-tracking branch 'origin/main'

This commit is contained in:
romanschenk37 2022-03-25 21:14:29 +01:00
commit c72ae904e7
1 changed files with 3 additions and 3 deletions

View File

@ -115,7 +115,7 @@ public class Track implements TrackSpecification {
char possibleCarChar = line.charAt(xPosition);
if (!allSpaceTypesAsChar.contains(possibleCarChar)) {
if (usedSymbolForCar.contains(possibleCarChar)) {
throw new InvalidTrackFormatException();
throw new InvalidTrackFormatException("More than one car on track!");
}
usedSymbolForCar.add(possibleCarChar);
cars.add(new Car(possibleCarChar, new PositionVector(xPosition, yPosition)));
@ -143,12 +143,12 @@ public class Track implements TrackSpecification {
}
}
if (finishLine.size() == 0) {
throw new InvalidTrackFormatException();
throw new InvalidTrackFormatException("No finish line found!");
}
finishTyp = getSpaceType(finishLine.get(0));
for (PositionVector positionVector : finishLine) {
if (getSpaceType(positionVector) != finishTyp) {
throw new InvalidTrackFormatException();
throw new InvalidTrackFormatException("Inconsistent finish line found!");
}
}
}