Skip to content

Migrate from JUnit 4 to JUnit 5 to resolve deprecation warnings #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2025

Conversation

xerial
Copy link
Member

@xerial xerial commented Jul 19, 2025

Summary

  • Migrates msgpack-jackson tests from JUnit 4 to JUnit 5
  • Resolves all JUnit deprecation warnings
  • Maintains test functionality and backward compatibility

Changes Made

  • Dependencies: Updated build.sbt to use JUnit 5 Jupiter and Vintage engines
  • Imports: Replaced JUnit 4 imports with JUnit 5 equivalents
  • Annotations:
    • @Test@Test (JUnit 5)
    • @Before@BeforeEach
    • @Test(expected=Exception.class)assertThrows(Exception.class, () -> {...})
  • Assertions: Replaced deprecated org.junit.Assert.assertThat with org.hamcrest.MatcherAssert.assertThat

Test Results

✅ All tests pass successfully
✅ No more JUnit deprecation warnings
✅ Compilation successful

Backward Compatibility

The JUnit Vintage engine is included to maintain compatibility with any remaining JUnit 4 tests.

🤖 Generated with Claude Code

- Update build.sbt to use JUnit 5 dependencies (jupiter + vintage)
- Replace JUnit 4 imports with JUnit 5 equivalents
- Convert @test(expected=Exception.class) to assertThrows()
- Update @before to @beforeeach annotation
- Replace deprecated org.junit.Assert.assertThat with Hamcrest assertThat
- Maintain backward compatibility with JUnit Vintage engine

Fixes all JUnit deprecation warnings in msgpack-jackson tests.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@xerial xerial merged commit 7367653 into main Jul 19, 2025
8 checks passed
@xerial xerial deleted the fix-junit branch July 19, 2025 16:39
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy