Add unit tests for OpenmrsUtil.isStringInArray#5754
Add unit tests for OpenmrsUtil.isStringInArray#5754varshithreddybokka4444-netizen wants to merge 4 commits into
Conversation
|
Hi, this is my first contribution to OpenMRS. |
| * @see OpenmrsUtil#isStringInArray(String, String[]) | ||
| */ | ||
| @Test | ||
| public void isStringInArray_shouldReturnFalseIfStringIsNull() { |
There was a problem hiding this comment.
Two additional cases to consider:
String[] arr = {"a", null, "b"};
OpenmrsUtil.isStringInArray(null, arr);OpenmrsUtil.isStringInArray(null, null);There was a problem hiding this comment.
Thanks for the suggestion! I’ve added tests to cover both of these cases.
Please let me know if any further adjustments are needed.
|
| @Test | ||
| public void nullSafeEqualsIgnoreCase_shouldBeCaseInsensitive() { | ||
| assertTrue(OpenmrsUtil.nullSafeEqualsIgnoreCase("equal", "Equal")); | ||
| } |
There was a problem hiding this comment.
Add a blank line before a new test starts.
There was a problem hiding this comment.
i have now added the blank line, thank you for correcion.
| public void isStringInArray_shouldHandleNullValuesInsideArray() { | ||
| String[] arr = {"a", null, "b"}; | ||
| assertTrue(OpenmrsUtil.isStringInArray("a", arr)); | ||
| assertFalse(OpenmrsUtil.isStringInArray("c", arr)); |
There was a problem hiding this comment.
Do we need this here? Feels like this test is doing two things at once.
There was a problem hiding this comment.
Thank you for correcting, i removed the line, please check now. Please sugest any more changes if needed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5754 +/- ##
=========================================
Coverage 59.26% 59.26%
- Complexity 9251 9253 +2
=========================================
Files 686 686
Lines 37219 37219
Branches 5445 5445
=========================================
Hits 22056 22056
- Misses 13201 13203 +2
+ Partials 1962 1960 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@varshithreddybokka4444-netizen can you resolve the merge conflicts? |
|
will resolve the merge conflicts as fast as possible |
0356d03 to
1c1354f
Compare
|
|
@wikumChamith i resolved conflicts, please check and suggest the changes if any |
|
@varshithreddybokka4444-netizen It doesn't look like a couple of the updates you made landed. Can you ensure you've properly pushed to your branch? |



Description of what I changed
Added unit tests for
OpenmrsUtil.isStringInArrayto cover standard and edge cases, including:These tests document and lock the expected behavior of the utility method.
Issue I worked on
N/A – test-only internal improvement (no JIRA issue required)
Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
I have added tests to cover my changes.
I ran
mvn clean packageright before creating this pull request.Note: The modified tests were run successfully via IntelliJ. Full test suite will be executed by CI.
All new and existing tests passed.
My pull request is based on the latest changes of the master branch.