Skip to content

8373830: Refactor test/jdk/java/time/test tests to use JUnit over TestNG#28911

Closed
justin-curtis-lu wants to merge 14 commits intoopenjdk:masterfrom
justin-curtis-lu:java.time-to-JUnit
Closed

8373830: Refactor test/jdk/java/time/test tests to use JUnit over TestNG#28911
justin-curtis-lu wants to merge 14 commits intoopenjdk:masterfrom
justin-curtis-lu:java.time-to-JUnit

Conversation

@justin-curtis-lu
Copy link
Member

@justin-curtis-lu justin-curtis-lu commented Dec 18, 2025

Please review this PR which migrates the java.time tests from TestNG to JUnit. The java.time tests use TestNG based on the directory level settings configured by TEST.properties, so they are best migrated altogether. This is a large PR, so I have tried to make the changes clear by commit.

First, the auto conversion tool is run in b1fd7db.
3805cfd and b697ca5 are required so that the tests can actually compile and run.
d07c912 addresses the timeout annotation which was not covered by the auto conversion tool.
The rest of the commits are aesthetic related.

Before conversion stats

Test results: passed: 187
Framework-based tests: 32,339 = 32,339 TestNG + 0 JUnit

After conversion stats

Test results: passed: 187
Framework-based tests: 32,339 = 0 TestNG + 32,339 JUnit

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

Issues

  • JDK-8373830: Refactor test/jdk/java/time/test tests to use JUnit over TestNG (Sub-task - P4)
  • JDK-8373829: Refactor test/jdk/java/time/tck tests to use JUnit over TestNG (Sub-task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28911

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

Using diff file

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

Using Webrev

Link to Webrev Comment

for (TemporalAccessor sample : samples()) {
sample.get(MockFieldNoValue.INSTANCE);
}
Assertions.assertThrows(DateTimeException.class, () -> {
Copy link
Member Author

@justin-curtis-lu justin-curtis-lu Dec 18, 2025

Choose a reason for hiding this comment

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

It appears that not all the TemporalAccessors from samples() are being tested. I want to keep the total count of tests before and after the migration the same, so handling this separate from this issue. Filed JDK-8374051.

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 18, 2025

👋 Welcome back jlu! 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

openjdk bot commented Dec 18, 2025

@justin-curtis-lu This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8373830: Refactor test/jdk/java/time/test tests to use JUnit over TestNG
8373829: Refactor test/jdk/java/time/tck tests to use JUnit over TestNG

Reviewed-by: naoto

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 2 new commits pushed to the master branch:

  • f1e0e0c: 8374544: Add SleepyCat diagnostics for all platforms
  • fbc59ac: 8374555: No need for visible input warning in s.s.u.Password when not reading from System.in

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title JDK-8373830: Refactor test/jdk/java/time/test tests to use JUnit over TestNG 8373830: Refactor test/jdk/java/time/test tests to use JUnit over TestNG Dec 18, 2025
@openjdk
Copy link

openjdk bot commented Dec 18, 2025

@justin-curtis-lu Command syntax:

  • /issue [add|remove] <id>[,<id>,...]
  • /issue [add] <id>: <description>

Some examples:

  • /issue add JDK-1234567,4567890
  • /issue remove JDK-4567890
  • /issue 1234567: Use this exact title

If issues are specified only by their ID, the title will be automatically retrieved from JBS. The project prefix (JDK- in the above examples) is optional. Separate multiple issue IDs using either spaces or commas.

@openjdk openjdk bot added core-libs core-libs-dev@openjdk.org i18n i18n-dev@openjdk.org labels Dec 18, 2025
@openjdk
Copy link

openjdk bot commented Dec 18, 2025

@justin-curtis-lu The following labels will be automatically applied to this pull request:

  • core-libs
  • i18n

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

@justin-curtis-lu
Copy link
Member Author

/issue add JDK-8373829

@openjdk
Copy link

openjdk bot commented Dec 18, 2025

@justin-curtis-lu
Adding additional issue to issue list: 8373829: Refactor test/jdk/java/time/tck tests to use JUnit over TestNG.

@justin-curtis-lu justin-curtis-lu marked this pull request as ready for review December 19, 2025 00:17
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 19, 2025
@mlbridge
Copy link

mlbridge bot commented Dec 19, 2025

Webrevs

Copy link
Member

@naotoj naotoj left a comment

Choose a reason for hiding this comment

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

LGTM over all. There may be a bug in the tool, as I see duplicated comments for no apparent reason (did not check all the files)
Also, please rename the directory java/time/nontestng to java/time/nonjunit.

static final int HIJRAH_DATE_TYPE = 6; // java.time.chrono.Ser.HIJRAH_DATE_TYPE
static final int MINGUO_DATE_TYPE = 7; // java.time.chrono.Ser.MINGUO_DATE_TYPE
static final int THAIBUDDHIST_DATE_TYPE = 8; // java.time.chrono.Ser.THAIBUDDHIST_DATE_TYPE
static final int THAIBUDDHIST_DATE_TYPE = 8; // java.time.chrono.Ser.THAIBUDDHIST_DATE_TYPE// java.time.chrono.Ser.THAIBUDDHIST_DATE_TYPE
Copy link
Member

Choose a reason for hiding this comment

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

The comment seems duplicated for no apparent reason. (Tool's bug?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for spotting, it does appear to be left by the tool. I searched for other occurrences and did not find any besides the ones you mentioned.

public class TCKChronologySerialization extends AbstractTCKTest {

static final int CHRONO_TYPE = 1; // java.time.chrono.Ser.CHRONO_TYPE
static final int CHRONO_TYPE = 1; // java.time.chrono.Ser.CHRONO_TYPE// java.time.chrono.Ser.CHRONO_TYPE
Copy link
Member

Choose a reason for hiding this comment

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

Same here

public class TCKEraSerialization extends AbstractTCKTest {

static final int JAPANESE_ERA_TYPE = 5; // java.time.chrono.Ser.JAPANESE_ERA
static final int JAPANESE_ERA_TYPE = 5; // java.time.chrono.Ser.JAPANESE_ERA// java.time.chrono.Ser.JAPANESE_ERA
Copy link
Member

Choose a reason for hiding this comment

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

And here too

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 20, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jan 6, 2026
@naotoj
Copy link
Member

naotoj commented Jan 6, 2026

Still looks good. I think the new commit warrants a copy right year increment

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 6, 2026
@justin-curtis-lu
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 6, 2026

Going to push as commit 53300b4.
Since your change was applied there have been 2 commits pushed to the master branch:

  • f1e0e0c: 8374544: Add SleepyCat diagnostics for all platforms
  • fbc59ac: 8374555: No need for visible input warning in s.s.u.Password when not reading from System.in

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 6, 2026
@openjdk openjdk bot closed this Jan 6, 2026
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 6, 2026
@openjdk
Copy link

openjdk bot commented Jan 6, 2026

@justin-curtis-lu Pushed as commit 53300b4.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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 i18n i18n-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants