Skip to content

8382264: Refactor java.logging TestNG tests to use JUnit#30769

Open
dfuch wants to merge 4 commits intoopenjdk:masterfrom
dfuch:junit-logging-8382264
Open

8382264: Refactor java.logging TestNG tests to use JUnit#30769
dfuch wants to merge 4 commits intoopenjdk:masterfrom
dfuch:junit-logging-8382264

Conversation

@dfuch
Copy link
Copy Markdown
Member

@dfuch dfuch commented Apr 16, 2026

Please find here a small change that converts java.logging TestNG tests to use JUnit. Most java.logging tests are plain jtreg tests, so this is a small set.



Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8382264: Refactor java.logging TestNG tests to use JUnit (Sub-task - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30769/head:pull/30769
$ git checkout pull/30769

Update a local copy of the PR:
$ git checkout pull/30769
$ git pull https://git.openjdk.org/jdk.git pull/30769/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30769

View PR using the GUI difftool:
$ git pr show -t 30769

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30769.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Apr 16, 2026

👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 16, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot added the core-libs core-libs-dev@openjdk.org label Apr 16, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 16, 2026

@dfuch The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Apr 16, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Apr 16, 2026

Webrevs

Comment on lines +44 to +47
* @run testng GetResourceBundleTest
* @run junit GetResourceBundleTest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this intentionally not use ${test.main.class}? (which you changed in the other test classes)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed.


@BeforeTest
public void setUp() throws Exception {
@BeforeAll
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LogRecordThreadIdTest previously used TestNG @BeforeTest, which runs before each @test method, so each test started with freshly constructed LogRecord instances. With JUnit @BeforeAll + static fields, the same instances are reused. The assertions still look safe because each test overwrites the state it cares about, but could you confirm this was intentional? If you want to preserve the old “fresh records per test” behavior, @beforeeach (possibly with non-static fields) would be closer to TestNG.

Copy link
Copy Markdown
Member Author

@dfuch dfuch Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand @BeforeTest means that the method will be run before any test in the test group. If there is no test group, the test group is the class. Which means that BeforeAll/BeforeTest/BeforeClass are all equivalent here. That said there's no real reason to use a setup method here. I simply removed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants