Skip to content

Conversation

@MonotonousHarsh
Copy link

JIRA Ticket

https://issues.openmrs.org/browse/TRUNK-6521

Description

The Issue:
The PersonService contract implies that querying getPersonByUuid with a non-existent UUID should return null. However, PersonServiceTest currently lacks a test case to enforce this "sad path" behavior.

Risk:
Without this coverage, a future regression could cause the service to throw an unhandled exception (e.g., ObjectNotFoundException) instead of returning null, potentially breaking downstream modules that expect a null check.

My Solution:

  • Added getPersonByUuid_shouldReturnNullIfNoPersonFoundWithUuid to PersonServiceTest.java.
  • Verifies that the API handles invalid UUIDs gracefully by returning null rather than crashing.

Dev Checklist

  • Added unit tests for new functionality
  • Ran mvn test -Dtest=PersonServiceTest (147 tests passed)

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant