Skip to content

Add unit tests for OpenmrsUtil.stringStartsWith#6122

Open
liujs123456 wants to merge 1 commit into
openmrs:masterfrom
liujs123456:TRUNK-test-stringStartsWith
Open

Add unit tests for OpenmrsUtil.stringStartsWith#6122
liujs123456 wants to merge 1 commit into
openmrs:masterfrom
liujs123456:TRUNK-test-stringStartsWith

Conversation

@liujs123456
Copy link
Copy Markdown

Summary

OpenmrsUtil.stringStartsWith(String, String[]) had no test coverage. This PR adds three unit tests covering its main behaviors:

  • returns true when the input starts with one of the given prefixes
  • returns false when the input matches none of the prefixes
  • returns false when the prefix array is empty

The tests live in OpenmrsUtilUnitTest (no Spring context required) and follow the style of the existing isStringInArray tests immediately above them.

Test plan

  • ./mvnw -pl api -am test -Dtest=OpenmrsUtilUnitTest runs all 52 tests green locally

The stringStartsWith(String, String[]) utility method had no test
coverage. Adds three tests covering the main behaviors:

- returns true when the input starts with one of the given prefixes
- returns false when the input matches none of the prefixes
- returns false when the prefix array is empty

Tests live in OpenmrsUtilUnitTest (no Spring context required) and
match the style of the existing isStringInArray tests right above
them.
@sonarqubecloud
Copy link
Copy Markdown

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