Skip to content

8379195: Refactor Arrays TestNG tests to use JUnit#30111

Closed
rgiulietti wants to merge 3 commits intoopenjdk:masterfrom
rgiulietti:8379195
Closed

8379195: Refactor Arrays TestNG tests to use JUnit#30111
rgiulietti wants to merge 3 commits intoopenjdk:masterfrom
rgiulietti:8379195

Conversation

@rgiulietti
Copy link
Copy Markdown
Contributor

@rgiulietti rgiulietti commented Mar 6, 2026

A migration from TestNG to 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

Issue

  • JDK-8379195: Refactor Arrays 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/30111/head:pull/30111
$ git checkout pull/30111

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30111

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Mar 6, 2026

👋 Welcome back rgiulietti! 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 Mar 6, 2026

@rgiulietti 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:

8379195: Refactor Arrays TestNG tests to use JUnit

Reviewed-by: alanb

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 66 new commits pushed to 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 added the core-libs core-libs-dev@openjdk.org label Mar 6, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 6, 2026

@rgiulietti 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 Mar 6, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Mar 6, 2026

Webrevs


@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just curious why this is needed as the method source is a static method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This test was converted by an automated tool, and this line was added by it.
I agree that it is not that useful in this case, but doesn't seem to hurt either.

Copy link
Copy Markdown
Contributor

@AlanBateman AlanBateman Mar 7, 2026

Choose a reason for hiding this comment

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

Just a passing concern that some future maintainer will wonder if these tests have something subtle to require them to run with the same test case instance.

If you choose to not address it, can you file a JBS issue to remove them?

Comment thread test/jdk/java/util/Arrays/AsList.java Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I assume a deeper migration would change this to assertThrows(UnsupportedOperationException.class, itr::remove).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes.

Comment thread test/jdk/java/util/Arrays/AsList.java Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In passing, I assume this assertFalse is redundant as it is checked in the loop.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see it as redundant as well, but it is harmless.

@@ -158,7 +160,8 @@ public void testParallelPrefixForInt(int[] data, int fromIndex, int toIndex, Int
assertArraysEqual(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex));
Copy link
Copy Markdown
Contributor

@AlanBateman AlanBateman Mar 6, 2026

Choose a reason for hiding this comment

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

With JUnit, the first parameter to assertArraysEquals is the "expected" as migration from TestNG will usually means transposing these parameters. It's really only an issue if there is failure of course, and only leads to a confusing message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The assertArraysEqual() in this class are not JUnit methods. It's their implementations that eventually invoke the real JUnit method, with expected and actual in the conventional JUnit order.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I get that, I'm just saying its a hazard to have these wrappers follow the TestNG ordering and then transpose to use the JUnit ordering.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see you've fixed this - thanks!

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Mar 7, 2026
@rgiulietti
Copy link
Copy Markdown
Contributor Author

/integrate

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 9, 2026

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk Bot added the integrated Pull request has been integrated label Mar 9, 2026
@openjdk openjdk Bot closed this Mar 9, 2026
@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 9, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 9, 2026

@rgiulietti Pushed as commit f1be820.

💡 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 integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants