diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Track.java b/src/main/java/ch/zhaw/pm2/racetrack/Track.java index bac8f92..61f5459 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Track.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Track.java @@ -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!"); } } }