(feat) O3-5578: Validate Queue Location tags in QueueValidator#107
(feat) O3-5578: Validate Queue Location tags in QueueValidator#107LxndrKrchvtsv wants to merge 2 commits into
Conversation
|
Hey @LxndrKrchvtsv , nice work picking up this TODO. A few things I wanted to flag after looking at the existing codebase: 1. Hardcoded string "Queue Location" - should this be a constant? 2. Double error on null location if (queue.getLocation() != null) {
LocationTag queueLocationTag = Context.getLocationService().getLocationTagByName("Queue Location");
if (queueLocationTag == null || !location.getTags().contains(queueLocationTag)) {
errors.rejectValue("location", "queue.location.invalid", "Location should be tagged as a Queue Location");
}
}3. What happens when the "Queue Location" tag doesn't exist in the system at all? 4. Context.getLocationService() vs existing pattern 5. Tests look solid overall - good coverage of the null case, missing tag, wrong tag, and happy path. One minor thing: in the null location test, you're not mocking Context.getLocationService(), which works because your code returns early on null, but it does rely on the execution order. If someone reorganizes the code later, that test might start throwing NPEs from the unmocked getLocationService(). Overall this is a clean change that addresses a real gap. The main thing I'd want to see fixed is the double-error on null location (#2) - the rest are suggestions. |
|



Requirements
the ticket number (feat) O3-5578 with conventional commit label.
Summary
Found a TODO: Check if the location is tagged as a Queue Location? - Then created new task and implemented it.
nullcheck for the location object.Context.getLocationService()to retrieve the"Queue Location"tag."Queue Location"tag.Screenshots
N/A
Related Issue
https://openmrs.atlassian.net/browse/O3-5578
Other
N/A