Skip to content

Migrated JVM tests from JUnit 4 to JUnit 5 - #1862

Merged
swankjesse merged 5 commits into
lysine-dev:mainfrom
wilburx9:migrate-jvm-junit5
Aug 27, 2026
Merged

Migrated JVM tests from JUnit 4 to JUnit 5#1862
swankjesse merged 5 commits into
lysine-dev:mainfrom
wilburx9:migrate-jvm-junit5

Conversation

@wilburx9

@wilburx9 wilburx9 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Basically, the title but here's a summary of the changes:

  • I basically switched the JUnit 4 dependency in the okio and samples modules to JUnit 5 and subsequently updated the imports.
  • I have tried to do this with as little changes as possible, but the tests in FakeFileSystemTest require updates to their constructors since JUnit 5 doesn't support multiple constructors.
  • I also added a helper function to create a temporary file after migrating from JUnit 4's TemporaryFolder to JUnit 5's @TempDir

This is the first PR for implementing #1846

@wilburx9

Copy link
Copy Markdown
Contributor Author

okio.WasiFileSystemTest.fileMetadataTimestampsAreDistinct is failing on my local machine, both in the main branch and this branch. Hopefully it's only a local issue; happy to investigate otherwise.

@swankjesse

Copy link
Copy Markdown
Collaborator

CI has this failure only:

OkioKotlinTest[jvm] > fileSink()[jvm] FAILED
    org.junit.platform.commons.JUnitException: Failed to close extension context
        at java.base@26.0.2/java.util.ArrayList.forEach(ArrayList.java:1612)
        at java.base@26.0.2/java.util.ArrayList.forEach(ArrayList.java:1612)

        Caused by:
        java.io.IOException: Failed to delete temp directory C:\Users\RUNNER~1\AppData\Local\Temp\junit-2733229505807075268. The following paths could not be deleted (see suppressed exceptions for details): <root>, tmp_file2143762405183197976.tmp
            at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:186)
            at java.base/java.util.ArrayList.forEach(ArrayList.java:1612)
            at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
            at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:261)
            at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:261)
            at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:571)
            at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
            at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:153)
            at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:176)
            at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
            at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:632)
            ... 2 more

@wilburx9

Copy link
Copy Markdown
Contributor Author

@swankjesse Should be fixed now

@swankjesse
swankjesse merged commit cad179f into lysine-dev:main Aug 27, 2026
11 checks passed
@swankjesse

Copy link
Copy Markdown
Collaborator

Thanks!

@JakeWharton JakeWharton mentioned this pull request Aug 27, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants