Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
public void setSize(int size) {
if (validateSize(size)) {
this.size = size;
- } /* FIXME: raise an error */
+ } else {
+ throw new IllegalArgumentException("Size must be between" + this.min + " and " + this.max);
+ }
}
private boolean validateSize(int size) {
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) {