repositories
/
Persons_Comparator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Throw an error for illegal arguments.
[Persons_Comparator.git]
/
src
/
Weight.java
diff --git
a/src/Weight.java
b/src/Weight.java
index 3f2a829163130f8bba5c5ed1e22e5fdd0fa916c3..2a8c8127d7cb17f63cbe5aa8e6a98a26209a3f24 100644
(file)
--- 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;
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) {
}
private boolean validateWeight(int weight) {