X-Git-Url: https://git.piment-noir.org/?p=Persons_Comparator.git;a=blobdiff_plain;f=src%2FWeight.java;h=2a8c8127d7cb17f63cbe5aa8e6a98a26209a3f24;hp=3f2a829163130f8bba5c5ed1e22e5fdd0fa916c3;hb=bcdec88755a4a44882edfbb96581294f77a6e1ed;hpb=9749119587561f5848349b7a1b9e7d9342944f0d diff --git a/src/Weight.java b/src/Weight.java index 3f2a829..2a8c812 100644 --- a/src/Weight.java +++ b/src/Weight.java @@ -12,7 +12,9 @@ public class Weight { public void setWeight(int weight) { if (validateWeight(weight)) { this.weight = weight; - } /* FIXME: raise an error */ + } else { + throw new IllegalArgumentException("Weight cannot be negative or zero"); + } } private boolean validateWeight(int weight) {