Skip to content

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Nov 4, 2025

This pull request migrates the test suite for the org.eclipse.ui.tests.navigator package from JUnit 4 to JUnit 5, modernizing the test codebase and improving test reliability with better resource cleanup between tests.

JUnit 5 Migration

Annotation Updates

  • Replaced @Before with @BeforeEach lifecycle annotation
  • Replaced @After with @AfterEach lifecycle annotation
  • Updated @Test imports from org.junit.Test to org.junit.jupiter.api.Test
  • Changed @Ignore to @Disabled where applicable

Assertion Updates

  • Migrated all static imports from org.junit.Assert to org.junit.jupiter.api.Assertions
  • Fixed assertion parameter order from JUnit 4 style (message-first) to JUnit 5 style (message-last):
    • assertEquals(message, expected, actual)assertEquals(expected, actual, message)
    • assertTrue(message, condition)assertTrue(condition, message)
    • assertFalse(message, condition)assertFalse(condition, message)

Files Updated

All test files in the navigator test suite were migrated, including:

  • ActionProviderTest.java
  • ActivityTest.java
  • DecorationSchedulerRaceConditionTest.java
  • DnDTest.java
  • EvaluationCacheTest.java
  • ExtensionsTest.java
  • FilterTest.java
  • FirstClassM1Tests.java
  • GoBackForwardsTest.java
  • INavigatorContentServiceTests.java
  • InitialActivationTest.java
  • LabelProviderTest.java
  • LinkHelperTest.java
  • M12Tests.java
  • NavigatorTestBase.java
  • OpenTest.java
  • PipelineChainTest.java
  • PipelineTest.java
  • ProgrammaticOpenTest.java
  • ResourceTransferTest.java
  • ShowInTest.java
  • SorterTest.java
  • WorkingSetTest.java
  • jst/JstPipelineTest.java
  • resources/FoldersAsProjectsContributionTest.java
  • resources/NestedResourcesTests.java
  • resources/PathComparatorTest.java
  • resources/ResourceMgmtActionProviderTests.java

Benefits

  • Modern Testing Framework: Uses latest JUnit 5 features and patterns
  • Better Resource Management: New extension provides more robust cleanup of UI resources
  • Improved Test Isolation: Ensures each test starts with a clean state
  • Consistent API: All assertions now use the standard JUnit 5 parameter order
  • Future-proof: Aligns with Eclipse platform's migration to JUnit 5

🤖 Generated with Claude Code

@vogella vogella marked this pull request as draft November 4, 2025 19:17
@vogella vogella force-pushed the claude/migrate-junit5-navigator-011CUoN5e3tNLn1omqjXa3JE branch 2 times, most recently from 9ae2db3 to d36f069 Compare November 4, 2025 19:19
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Test Results

 3 018 files  ±0   3 018 suites  ±0   2h 4m 22s ⏱️ - 3m 16s
 8 234 tests ±0   7 985 ✅ ±0  249 💤 ±0  0 ❌ ±0 
23 622 runs  ±0  22 828 ✅ ±0  794 💤 ±0  0 ❌ ±0 

Results for commit d469ae8. ± Comparison against base commit 02dabfc.

♻️ This comment has been updated with latest results.

@vogella vogella force-pushed the claude/migrate-junit5-navigator-011CUoN5e3tNLn1omqjXa3JE branch from d36f069 to e3000ef Compare November 7, 2025 18:12
@HannesWell
Copy link
Member

Can you please make the title meaningful?

@vogella
Copy link
Contributor Author

vogella commented Nov 9, 2025

Please do not review drafts

@laeubi
Copy link
Contributor

laeubi commented Nov 10, 2025

Please do not review drafts

I agree with @HannesWell that a PR (regardless of its status) should have a meaningful title and PR description. If you just want to dump some code, just push it to your fork and enable actions for it so you get (except Jenkins) the same checks as when open a PR. Then when it is ready simply close the PR in your fork and reopen a new on against the base repository.

We are already approaching 100 open PRs soon and having ones with unclear status and scope does not really help.

I now generated a description with copilot and leave the title to you as the author...

@vogella
Copy link
Contributor Author

vogella commented Nov 10, 2025

Fun fact: Today I received multiple reviews for my draft PR but none for my none draft reviews.

@vogella
Copy link
Contributor Author

vogella commented Nov 10, 2025

Please do not review drafts

I agree with @HannesWell that a PR (regardless of its status) should have a meaningful title and PR description. If you just want to dump some code, just push it to your fork and enable actions for it so you get (except Jenkins) the same checks as when open a PR. Then when it is ready simply close the PR in your fork and reopen a new on against the base repository.

We are already approaching 100 open PRs soon and having ones with unclear status and scope does not really help.

I now generated a description with copilot and leave the title to you as the author...

I'm now looking into my draft review, please do not change it.

@vogella vogella force-pushed the claude/migrate-junit5-navigator-011CUoN5e3tNLn1omqjXa3JE branch from 068952c to 633b9d4 Compare November 10, 2025 12:34
@vogella vogella changed the title Claude/migrate junit5 navigator 011 c uo n5e3t n ln1omqj xa3 je Migrate org.eclipse.ui.tests.navigator from JUnit 4 to JUnit 5 Nov 10, 2025
vogella pushed a commit to vogella/eclipse.platform.ui that referenced this pull request Nov 10, 2025
Convert JUnit 4 style assertions (message-first) to JUnit 5 style
(message-last) in the following test files:
- FirstClassM1Tests.java
- GoBackForwardsTest.java
- INavigatorContentServiceTests.java

This completes the assertion parameter order fixes for PR eclipse-platform#3500.
@vogella vogella force-pushed the claude/migrate-junit5-navigator-011CUoN5e3tNLn1omqjXa3JE branch from 633b9d4 to 286d18e Compare November 10, 2025 16:14
vogella pushed a commit to vogella/eclipse.platform.ui that referenced this pull request Nov 10, 2025
Complete the JUnit 4 to JUnit 5 assertion parameter order migration:
- SorterTest.java: Fix 1 assertEquals call
- WorkingSetTest.java: Fix 11 assertTrue and assertEquals calls
- JstPipelineTest.java: Fix 2 assertEquals and 1 assertTrue call
- FoldersAsProjectsContributionTest.java: Fix 6 assertFalse and 2 assertTrue calls
- NestedResourcesTests.java: Fix 3 assertTrue calls
- PathComparatorTest.java: Fix 1 assertTrue call
- ResourceMgmtActionProviderTests.java: Fix 1 assertTrue call

All assertions now follow JUnit 5 convention with message parameter last.
This resolves all remaining compilation errors in PR eclipse-platform#3500.
This commit migrates the entire org.eclipse.ui.tests.navigator test
suite
from JUnit 4 to JUnit 5, modernizing the test infrastructure and
improving
test reliability with better resource management.

JUnit 5 Migration Changes:
- Updated all test annotations (@before@beforeeach, @after →
@AfterEach,
  @ignore@disabled)
- Migrated static imports from org.junit.Assert to
  org.junit.jupiter.api.Assertions
- Replaced CloseTestWindowsRule (JUnit 4) with inline window management:
    - Added @AfterEach tearDown() method
    - Inlined window listener and shell tracking logic
    - This avoids needing to add JUnit 5 dependencies to the test
harness bundle
- Fixed all assertion parameter orders from JUnit 4 style
(message-first) to
  JUnit 5 style (message-last):
  * assertEquals(message, expected, actual) → assertEquals(expected,
actual, message)
  * assertTrue(message, condition) → assertTrue(condition, message)
  * assertFalse(message, condition) → assertFalse(condition, message)

Test Infrastructure Improvements:

  manages UI test windows and shell cleanup, replacing the previous
JUnit 4
  rule-based approach
- Updated GoBackForwardsTest to use @RegisterExtension with the new
extension
- Ensures better test isolation by cleaning up leaked shells between
tests

Benefits:
- Uses modern JUnit 5 features and best practices
- Improved resource cleanup prevents test interference
- Consistent with Eclipse platform's migration to JUnit 5
- Better test isolation and reliability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@vogella vogella force-pushed the claude/migrate-junit5-navigator-011CUoN5e3tNLn1omqjXa3JE branch from 286d18e to d469ae8 Compare November 10, 2025 18:01
@vogella vogella marked this pull request as ready for review November 10, 2025 18:48
@vogella vogella merged commit 0e238b7 into eclipse-platform:master Nov 12, 2025
18 checks passed
@vogella vogella deleted the claude/migrate-junit5-navigator-011CUoN5e3tNLn1omqjXa3JE branch November 12, 2025 08:56
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