diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2025-04-07 21:00:53 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2025-04-07 21:00:53 -0400 |
commit | 426b21de0a3f7ee8706b83af4acddb731798be2c (patch) | |
tree | b51bda63a4bbbef158353600a878e8192f7f7952 /ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java | |
parent | 71e01e85a33b0109847867878b2af733b4751e46 (diff) | |
parent | 7617db08a43d873a65abd47b02e23ad8cb4cb5cd (diff) | |
download | JellySolutions-426b21de0a3f7ee8706b83af4acddb731798be2c.tar.gz JellySolutions-426b21de0a3f7ee8706b83af4acddb731798be2c.tar.bz2 JellySolutions-426b21de0a3f7ee8706b83af4acddb731798be2c.zip |
Merge branch 'main' into call-to-action
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java')
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java index 859194a..33b272b 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java @@ -41,6 +41,8 @@ public class CupboardService { throw new IllegalArgumentException("Max Goal must be greater than zero"); } else if (goalType.equals(Need.GoalType.PHYSICAL) && maxGoal % 1 != 0) { throw new IllegalArgumentException("Cannot have non whole number value for physical goal"); + } else if (name == null || name.isEmpty()) { + throw new IllegalArgumentException("Required fields cannot be blank"); } for (Need searchNeed : cupboardDAO.getNeeds()) { @@ -103,6 +105,8 @@ public class CupboardService { throw new IllegalArgumentException("Goal must be greater than 0"); } else if (need.getType().equals(Need.GoalType.PHYSICAL) && need.getMaxGoal() % 1 != 0) { throw new IllegalArgumentException("Cannot have non whole number value for physical goal"); + } else if (need.getName() == null || need.getName().isEmpty()) { + throw new IllegalArgumentException("Required fields cannot be blank"); } return cupboardDAO.updateNeed(need); } |