Skip to content

test: restore 5 silently-dropped tests; remove dead JUnit 4 infra#1324

Merged
joaodinissf merged 2 commits into
dsldevkit:masterfrom
joaodinissf:chore/junit4-source-migration-step-2
May 6, 2026
Merged

test: restore 5 silently-dropped tests; remove dead JUnit 4 infra#1324
joaodinissf merged 2 commits into
dsldevkit:masterfrom
joaodinissf:chore/junit4-source-migration-step-2

Conversation

@joaodinissf
Copy link
Copy Markdown
Collaborator

@joaodinissf joaodinissf commented Apr 30, 2026

Summary

Step 2 of the staged JUnit cleanup. Stacks on #1323 — review/merge that first; this PR's diff shows step-1's commits at the bottom until #1323 lands.

Two related changes uncovered while restoring test discovery in #1323:

  1. Restore 5 tests silently dropped during the Oct 2025 JUnit 5 migration (50 @test methods total).
  2. Delete the dead JUnit 4 test infrastructure the migration left behind (49 files / ~9.9k lines).

Restored tests (commit 1)

  • CheckCoreTestSuite: CheckValidationTest (30), CheckJavaValidatorUtilTest (13), CheckApiAccessValidationsTest (3) — all dropped when the migration silently downgraded CheckJavaValidatorUtilTest to package-private.
  • ExportTestSuite: ExportValidationOkTest (1) — never in any suite since creation.
  • GeneratorTestSuite: XbaseGeneratorFragmentTest (3) — orphaned in Feb 2022; restored with mock chain rewrite to track Xtext API drift in XbaseUsageDetector.

Discovered by computing @SelectClasses transitive closure from AllTests and diffing against all classes containing @Test methods.

Deletions (commit 2)

49 files / ~9.9k lines: JUnit 4 runner+filter subsystem (test.core/junit/runners/), recording-runner support, non-jupiter rules/helpers, non-jupiter base test classes (AbstractTest, AbstractXtextTest, etc.), and the orphaned FormatterTest duplicate. All dead — every external import resolved to the .../jupiter/ siblings before this PR.

ValidationHelper is migrated rather than deleted (still used by jupiter/AbstractXtextTestUtil); its dependency on AbstractValidationTest.assertNoErrorsOnResource is inlined and switched to org.junit.jupiter.api.Assertions.fail.

Verification

Local mvn verify (macOS aarch64): 357 tests, 0 errors.

Step 2 of 4

Step 2 follow-up (#1325) migrates remaining AssertAssertions calls in helpers. Step 3 (#1326) drops org.junit 4.13.2 and vintage-engine from the target. Step 4 (#1327) atomically upgrades to JUnit 6 + Eclipse 4.39.

🤖 Generated with Claude Code

@joaodinissf joaodinissf force-pushed the chore/junit4-source-migration-step-2 branch from 3c9c270 to 6088f97 Compare May 5, 2026 22:45
@joaodinissf joaodinissf changed the title chore: clean up JUnit 4 source surface (restore dropped tests + delete dead infrastructure) test: restore 5 silently-dropped tests; remove dead JUnit 4 infra May 5, 2026
@joaodinissf joaodinissf marked this pull request as ready for review May 5, 2026 22:45
joaodinissf and others added 2 commits May 6, 2026 11:48
The Oct 2025 JUnit 5 migration silently dropped 5 test classes from
their suites (50 @test methods total):

  CheckCoreTestSuite was missing:
    CheckValidationTest           (30 @test)
    CheckJavaValidatorUtilTest    (13 @test)
    CheckApiAccessValidationsTest  (3 @test)
  ExportTestSuite was missing:
    ExportValidationOkTest         (1 @test)
  GeneratorTestSuite was missing:
    XbaseGeneratorFragmentTest     (3 @test)

The CheckCoreTestSuite drops trace to a single mistake in d5328e1:
the migration also changed `public class CheckJavaValidatorUtilTest
extends TestCase` -> `class CheckJavaValidatorUtilTest`, making the
class package-private. That broke the cross-package import in the
suite, and rather than restore visibility the import was deleted --
silently dropping the other two CheckCoreTestSuite tests as
collateral.

ExportValidationOkTest was added to xtext.export.test in d08ea19
but never included in any suite at any point.

XbaseGeneratorFragmentTest was orphaned much earlier (Feb 2022, by
45aed05 + e59c902) during a legacy-generator cleanup. Restoring
it now requires updating its mocks to track Xtext API drift:
XbaseUsageDetector now navigates
`rule.eResource().getResourceSet().getEObject(URI, true)` and
compares via EcoreUtil2.isAssignableFrom (was a package-name
comparison). The mock setup is updated so the resource-set lookup
yields a shared mock EClass that matching rules also return --
reference equality preserves the original test intent.

Discovered by computing @SelectClasses transitive closure from
AllTests and diffing against all classes containing @test methods.

Verified locally: 307 -> 357 tests run (+50), 0 new errors or
failures. The 5 restored classes appear in surefire reports for the
first time since the migration.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Oct 2025 JUnit 5 migration left two parallel test-infrastructure
trees in place: the old JUnit 4 base classes / runners / filters in
the original packages, and the new Jupiter-based equivalents in
.../jupiter/ subpackages. Test classes have been migrated to the
jupiter versions for some time (every external import resolves to a
jupiter package), so the old tree is unreachable from any live test.

Delete the dead tree in one cohesive cut. One file (ValidationHelper)
is migrated rather than deleted because jupiter/AbstractXtextTestUtil
still uses it -- its dependency on
AbstractValidationTest.assertNoErrorsOnResource is inlined and
switched to org.junit.jupiter.api.Assertions.fail.

Removed - JUnit 4 runner/filter subsystem (test.core/junit/runners/):
  ClassRunner, DiscerningSuite, DynamicSuite, FilterRegistry,
  NegatedFilter, SorterUtil
  + 14 *MethodFilter / *ClassFilter / *Filter classes:
    DebugClassFilter, DebugMethodFilter, FixedIssueFilter,
    FlakyMethodFilter, IntegrationTestMethodFilter,
    ModuleTestMethodFilter, NameMethodFilter,
    PerformanceTestMethodFilter, SwtBotClassFilter,
    SystemTestMethodFilter, TestLabelFilter (junit/runners/
    duplicate), UnitTestMethodFilter, UnresolvedBugMethodFilter,
    UnresolvedIssueFilter

Removed - recording-runner support (test.ui, xtext.test.core):
  SwtBotRecordingTestRunner, TestRunRecording,
  SwtBotRecordingXtextTestRunner, XtextClassRunner

Removed - non-jupiter rules / helpers in test.core (rule logic now
lives in test.core.jupiter equivalents):
  AbstractSystemTest, BugTestAwareRule, IssueAwareRule, LoggingRule,
  StatementFactory, TestLabelFilter, TestPlan

Removed - non-jupiter base test classes in xtext.test.core (replaced
by .../xtext/test/jupiter/ siblings):
  AbstractTest, AbstractXtextTest, AbstractXtextTestUtil,
  AbstractXtextMarkerBasedTest, AbstractFormattingTest,
  AbstractGeneratorTest, AbstractAcfContentAssistTest,
  AbstractScopingTest, AbstractValidationTest, AbstractLinkingTest,
  AbstractValueConverterServiceTest, AbstractModelInferrerTest,
  AbstractJvmModelInferrerTest, AbstractResourceDescriptionManagerTest

Removed - duplicated/dead test classes in xtext.test:
  AbstractFormatterTest, FormatterTest (orphaned non-jupiter
  duplicate; live twin xtext.jupiter.formatter.FormatterTest is in
  XtextTestSuite), FormatterTestUtil

Migrated - ValidationHelper: imports
  org.junit.jupiter.api.Assertions.fail; assertNoSyntaxOrLinkingErrors
  inlines the resource-error check that previously delegated to the
  deleted AbstractValidationTest.assertNoErrorsOnResource.

Verified locally: 357 tests run (unchanged from the restore commit),
0 errors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@joaodinissf joaodinissf force-pushed the chore/junit4-source-migration-step-2 branch from 6088f97 to ecbd49a Compare May 6, 2026 09:49
@joaodinissf
Copy link
Copy Markdown
Collaborator Author

@rubenporras I just checked and there's quite a bit of blast radius in the downstream projects, we should probably finish the clean-up there before merging this.

@joaodinissf joaodinissf merged commit d920b3b into dsldevkit:master May 6, 2026
4 checks passed
@joaodinissf joaodinissf deleted the chore/junit4-source-migration-step-2 branch May 19, 2026 13:21
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.

2 participants