(test) TRUNK-6603: Add unit tests for ProviderService APIException#5997
(test) TRUNK-6603: Add unit tests for ProviderService APIException#5997AshThe25 wants to merge 4 commits intoopenmrs:masterfrom
Conversation
| if (provider == null) { | ||
| throw new APIException("Provider not found for uuid: " + uuid); | ||
| } | ||
|
|
There was a problem hiding this comment.
Remove extra spaces before and after this if() statement
There was a problem hiding this comment.
Thanks for the feedback! I've removed wildcard imports and replaced them with explicit imports.
Also fixed formatting issues and removed extra spaces for consistency.
Updated the PR title for better clarity.
| @@ -0,0 +1,46 @@ | |||
| import static org.junit.jupiter.api.Assertions.*; | |||
| import static org.mockito.Mockito.*; | |||
There was a problem hiding this comment.
Remove wild cards, it's a must to do actual imports not generic wild card imports
There was a problem hiding this comment.
Thanks for the feedback! I've removed wildcard imports and replaced them with explicit imports.
Also fixed formatting issues and removed extra spaces for consistency.
|
|
||
| when(dao.getProviderByUuid(uuid)).thenReturn(provider); | ||
|
|
||
| Provider result = service.getProviderByUuid(uuid); |
| @Test | ||
| public void getProviderByUuid_shouldThrowException_whenProviderNotFound() { | ||
| String uuid = "invalid-uuid"; | ||
|
|
|
Improve your title by adding The name of the Ticket you're working on, if any, add link to Ticket if any. |
cae7a18 to
c6263da
Compare
Thanks for the feedback! I've removed wildcard imports and replaced them with explicit imports. Also fixed formatting issues and removed extra spaces for consistency. Updated the PR title for better clarity. |
|
Excellent addition of unit tests for edge cases. It's important to verify how the APIException handles null messages. |
THANKS A LOT KANISHKA MEANS A LOT |
|
Kanishka680
left a comment
There was a problem hiding this comment.
Excellent addition of unit tests for edge cases. It's important to verify how the APIException handles null messages.
Kanishka680
left a comment
There was a problem hiding this comment.
The implementation of the pluggable validator looks very modular. Great use of the UserService interface.



Description
This code adds unit tests for getProviderByUuid. The tests ensure that the method behaves correctly if a provider is found or not.
Tests
Context
This code is an extension of the previous fix that prevents silent returns of null.