Skip to content

Add missing @Test annotations to 4 tests JUnit 5 does not collect (2.x) - #6268

Merged
cowtowncoder merged 1 commit into
FasterXML:2.xfrom
dylanpulver:tests/collect-unannotated-junit5-tests-2x
Oct 5, 2026
Merged

cowtowncoder merged 1 commit into
FasterXML:2.xfrom
dylanpulver:tests/collect-unannotated-junit5-tests-2x

Conversation

@dylanpulver

Copy link
Copy Markdown
Contributor

The 2.x counterpart of #6266, as @pjfanning asked for there.

EmptyContentAsTreeTest names its four methods test... and annotates none of them. The class extends DatabindTestUtil rather than TestCase, so nothing collects them by name either, and the class has been running zero tests while the build stayed green.

mvn test goes from 4868 to 4872. All four pass as written, so this adds coverage rather than changing behaviour.

How much smaller 2.x is

One class, against 27 methods in 12 files on 3.x. Most of the 3.x cases came in with that branch's own test migration, so they have no 2.x equivalent.

Left out, same as on 3.x

src/test-jdk21/.../Java21CollectionsTest has the same two uncollected methods on both branches. Annotating them fails with IllegalAccessException, because the module does not export com.fasterxml.jackson.databind.jdk21 to org.junit.platform.commons. That needs a module or surefire decision rather than an annotation.

One thing worth knowing

ObjectWriterTest.testViewSettings fails on clean 2.x for me, before any change:

ObjectWriterTest.testViewSettings:186 expected: not same but was: <...ObjectWriter@503ed922>

It fails identically with and without this change, so it is not from here, but you may want to know it is red locally.

The 2.x counterpart of FasterXML#6266, requested on that PR.

`EmptyContentAsTreeTest` names its four methods `test...` but annotates none of
them, and the class extends `DatabindTestUtil` rather than `TestCase`, so
nothing collects them by name either. The class has been running zero tests.

`mvn test` goes from 4868 to 4872. All four pass as written, so this adds
coverage without changing behaviour.

The 2.x surface is much smaller than 3.x: this one class is the only case on
this branch, against 27 methods in 12 files on `3.x`. `Java21CollectionsTest`
under `src/test-jdk21` has the same two uncollected methods on both branches
and is excluded for the same reason as in FasterXML#6266, since annotating them fails
with `IllegalAccessException` because the module does not export
`com.fasterxml.jackson.databind.jdk21` to `org.junit.platform.commons`.
@gitar-bot

gitar-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
CI failed: 7 test errors occurred due to a Mockito initialization incompatibility with Java 21, unrelated to the PR's addition of missing JUnit 5 @test annotations.

Overview

1 test execution failure pattern was found across 1 analyzed log, resulting in 7 test errors due to Mockito initialization issues on Java 21. Overall assessment is that this is an environment/dependency compatibility issue unrelated to the changes in the PR.

Failures

Mockito Initialization Failure on Java 21 (confidence: high)

  • Type: test
  • Affected jobs: 111591289974
  • Related to change: no
  • Root cause: Tests such as LazyIgnoralForNumbers3730Test fail with an IllegalStateException when initializing the Mockito mock maker, which occurs when using an older Mockito version on Java 21 without proper compatibility configurations.
  • Suggested fix: Upgrade Mockito to a version that natively supports Java 21 or provide the required JVM arguments and byte-buddy agent settings.

Summary

  • Change-related failures: 0 failures
  • Infrastructure/flaky failures: 0 infrastructure failures (1 dependency compatibility/test error set)
  • Recommended action: Upgrade the Mockito dependency or adjust JVM settings to support Java 21 execution.
Code Review ✅ Approved

🟢 Low risk · Adds JUnit discovery annotations to four existing tests without runtime changes.

Adds missing @Test annotations to 4 uncollected test methods in EmptyContentAsTreeTest. All four tests pass as written, adding test coverage without behavior changes. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@cowtowncoder

Copy link
Copy Markdown
Member

NOTE: test-only changes, ok without CLA.

@cowtowncoder
cowtowncoder merged commit 2fa7169 into FasterXML:2.x Oct 5, 2026
7 of 8 checks passed
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