Merged
Conversation
- Replace all JUnit 4 imports with JUnit 5 Jupiter equivalents (org.junit.Test → org.junit.jupiter.api.Test, etc.) - Update @before → @beforeeach, @ignore → @disabled - Switch BaseModuleWebContextSensitiveTest and BaseWebContextSensitiveTest to their jupiter package variants - Replace @rule ExpectedException and @test(expected=...) with assertThrows() - Fix assertion parameter order (message moved from first to last arg) - Replace deprecated org.mockito.Matchers with org.mockito.ArgumentMatchers - Replace org.junit.Assert.assertThat with org.hamcrest.MatcherAssert.assertThat - Remove unnecessary Mockito stubs causing UnnecessaryStubbingException - Upgrade maven-surefire-plugin from 2.22.1 to 3.5.2 - Add aligned JUnit Platform 6.0.3 dependencies to fix version mismatch Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Reorder 3-arg assertNotSame in ConceptFormControllerTest to JUnit 5 parameter order (unexpected, actual, message) - Use containsString instead of is matcher in RegexValidatedTextDatatypeHandlerTest to preserve the original substring-matching behavior of ExpectedException.expectMessage() Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates all ~70 test files in the omod module from JUnit 4 to JUnit 5 (Jupiter) to align with openmrs-core 3.0.0-SNAPSHOT which has completed its JUnit 5 migration.
Changes
Import migrations
org.junit.Test→org.junit.jupiter.api.Testorg.junit.Assert→org.junit.jupiter.api.Assertionsorg.junit.Before/@Before→org.junit.jupiter.api.BeforeEach/@BeforeEachorg.junit.After/@After→org.junit.jupiter.api.AfterEach/@AfterEachorg.junit.Ignore/@Ignore→org.junit.jupiter.api.Disabled/@Disabledjunit.framework.Assert→org.junit.jupiter.api.Assertionsorg.junit.Assert.assertThat→org.hamcrest.MatcherAssert.assertThatorg.mockito.Matchers→org.mockito.ArgumentMatchersBase test class updates
org.openmrs.web.test.BaseModuleWebContextSensitiveTest→org.openmrs.web.test.jupiter.BaseModuleWebContextSensitiveTestorg.openmrs.web.test.BaseWebContextSensitiveTest→org.openmrs.web.test.jupiter.BaseWebContextSensitiveTestPattern replacements
@Rule ExpectedException→Assertions.assertThrows()@Test(expected = X.class)→Assertions.assertThrows()Build configuration
maven-surefire-pluginfrom 2.22.1 to 3.5.2Mockito cleanup
UnnecessaryStubbingExceptionunder JUnit 5's stricter Mockito defaultsTest results