Throw an error for illegal arguments.
[Persons_Comparator.git] / src / Weight.java
index 3f2a829163130f8bba5c5ed1e22e5fdd0fa916c3..2a8c8127d7cb17f63cbe5aa8e6a98a26209a3f24 100644 (file)
@@ -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) {