Skip to content

Convert tests from TestNG to JUnit 5#4259

Open
evanchooly wants to merge 1 commit into
masterfrom
claude/convert-testng-to-junit-cJoaO
Open

Convert tests from TestNG to JUnit 5#4259
evanchooly wants to merge 1 commit into
masterfrom
claude/convert-testng-to-junit-cJoaO

Conversation

@evanchooly
Copy link
Copy Markdown
Member

Summary

  • Replace all TestNG annotations with JUnit 5 equivalents (@BeforeEach, @AfterEach, @BeforeAll, @AfterAll, @Disabled, @Tag, @DisplayName, @ParameterizedTest, @MethodSource)
  • Swap assertEquals/assertNotEquals argument order from TestNG convention (actual, expected) to JUnit 5 convention (expected, actual)
  • Convert @DataProvider methods to static Stream<Arguments> with Arguments.of(...) rows
  • Wrap expectedExceptions test bodies in assertThrows() blocks
  • Replace throw new SkipException(...) with Assumptions.assumeTrue(false, ...)
  • Add @TestInstance(Lifecycle.PER_CLASS) to TemplatedTestBase so @AfterAll works on instance methods (annotation is @Inherited, covers all 261 subclasses)
  • Update TemplatedTestBase.validateTestName() to read @DisplayName instead of TestNG's @Test.testName()
  • Fix array equality: assertEquals(double[], double[], delta)assertArrayEquals in DoubleMappingTest/FloatMappingTest
  • Remove invalid class-level @Test annotations; add @Test to individual test methods where needed
  • Update all pom.xml files: remove TestNG dependency, add JUnit Jupiter 5.11.4 + params
  • Add <useModulePath>false</useModulePath> to maven-surefire-plugin

Test plan

  • ./mvnw install -pl :morphia-core -DskipTests compiles cleanly
  • ./mvnw test -pl :morphia-core -Dtest="TypesTest" passes (44 parameterized tests)
  • ./mvnw install -pl :examples -DskipTests compiles cleanly
  • ./mvnw install -pl :morphia-validation -DskipTests compiles cleanly
  • ./mvnw install -pl :morphia-kotlin -DskipTests compiles cleanly
  • Full test suite run against a MongoDB instance

https://claude.ai/code/session_01FHUBbAt2yQbG2nB5fNwsnz


Generated by Claude Code

Copilot AI review requested due to automatic review settings May 20, 2026 12:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@evanchooly evanchooly requested a review from Copilot May 21, 2026 04:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@evanchooly evanchooly force-pushed the claude/convert-testng-to-junit-cJoaO branch from 73ec4a8 to 8ed6edf Compare May 25, 2026 03:52
@evanchooly evanchooly force-pushed the claude/convert-testng-to-junit-cJoaO branch from bcfc6c1 to 63d2fed Compare May 25, 2026 05:30
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.

3 participants