diff --git a/src/edu/kit/informatik/model/RollingStock.java b/src/edu/kit/informatik/model/RollingStock.java index 6d08e3b..783448e 100644 --- a/src/edu/kit/informatik/model/RollingStock.java +++ b/src/edu/kit/informatik/model/RollingStock.java @@ -27,13 +27,16 @@ public abstract class RollingStock { * @param length length of this rolling stock * @param couplingFront whether this rolling stock should have a front coupling * @param couplingBack whether this rolling stock should have a back coupling - * @throws InvalidInputException on invalid user input (zero-sized coach) + * @throws InvalidInputException on invalid user input (e.g. zero-sized coach) */ protected RollingStock(final int length, final boolean couplingFront, final boolean couplingBack) throws InvalidInputException { if (length < 1) { throw new InvalidInputException("rolling stock length has to be positive"); } + if (!couplingFront && !couplingBack) { + throw new InvalidInputException("rolling stocks needs at least one coupling"); + } this.length = length; this.couplingFront = couplingFront; this.couplingBack = couplingBack;