Skip to content

8310049: Refactor Charset tests to use JUnit#14500

Closed
justin-curtis-lu wants to merge 28 commits intoopenjdk:masterfrom
justin-curtis-lu:JDK-8310049-CharsetTests
Closed

8310049: Refactor Charset tests to use JUnit#14500
justin-curtis-lu wants to merge 28 commits intoopenjdk:masterfrom
justin-curtis-lu:JDK-8310049-CharsetTests

Conversation

@justin-curtis-lu
Copy link
Member

@justin-curtis-lu justin-curtis-lu commented Jun 15, 2023

As discussed in https://github.com/openjdk/jdk/pull/14473/files, tests within test/jdk/java/nio/charset/Charset could benefit from using a test framework such as 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-8310049: Refactor Charset tests to use JUnit (Sub-task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14500

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 15, 2023

👋 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 openjdk bot added the rfr Pull request is ready for review label Jun 15, 2023
@openjdk
Copy link

openjdk bot commented Jun 15, 2023

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

  • i18n
  • nio

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.

@openjdk openjdk bot added nio nio-dev@openjdk.org i18n i18n-dev@openjdk.org labels Jun 15, 2023
@mlbridge
Copy link

mlbridge bot commented Jun 15, 2023

Webrevs

Copy link
Contributor

@LanceAndersen LanceAndersen left a comment

Choose a reason for hiding this comment

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

Thanks for starting this migration/refactor.

I would use this as an opportunity to add additional comments introducing the tests and the relevant parameterized lists et al


/* @test
* @bug 4422044
* @bug 4422044 8310049
Copy link
Contributor

Choose a reason for hiding this comment

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

As this is just a refactor, I don't think you need the bug number for converting to junit

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, in this file and the others

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.

Thanks for the clean-up. Some comments follow:

*/
@ParameterizedTest
@MethodSource("standardCharsets")
public void standardCharsetsTest(Charset containerCs, Charset cs, boolean cont){
Copy link
Member

Choose a reason for hiding this comment

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

ISO-8859-15 and CP1252 are not StandardCharsets so renaming the method to standardCharsetsTest seems incorrect.

Copy link
Member Author

Choose a reason for hiding this comment

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

Did not realize, thank you. I simply renamed it to charsets (as I am not sure if those tested are supposed to represent a particular group, or if they are just random).

@@ -1,36 +0,0 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

This class is used in DefaultCharsetTest so don't remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thank you

Comment on lines +46 to +51
// Charset.forName should throw an exception when passed "default"
@Test
public void defaultCharsetTest() {
assertThrows(UnsupportedCharsetException.class,
() -> Charset.forName("default"));
}
Copy link
Member

Choose a reason for hiding this comment

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

Seems incorrect to merge this test into IllegalCharsetName.java because it is throwing UnsupportedCharsetException.

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved it back to RegisteredCharsets.java

Comment on lines +45 to +50
// Charset.forName should throw an exception when passed null
@Test
public void nullCharsetTest() {
assertThrows(IllegalArgumentException.class,
() -> Charset.forName(null));
}
Copy link
Member

Choose a reason for hiding this comment

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

Missed this one previously. This one is also not IllegalCharsetName, so I'd prefer not to merge this either.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess when I think of illegal (I group anything that is wrong, so I initially included null and "default"). But you are right that it does not throw IllegalCharsetNameException so it should be moved into its own test. Fixed.

@openjdk
Copy link

openjdk bot commented Jun 16, 2023

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

8310049: Refactor Charset tests to use JUnit

Reviewed-by: lancea, 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 25 new commits pushed to the master branch:

  • 16134f4: 8310211: serviceability/jvmti/thread/GetStackTrace/getstacktr03/getstacktr03.java failing
  • d6c2ee3: 8310054: ScrollPane insets are incorrect
  • 4eb4f20: 8308808: SunMSCAPI public keys returns internal key array
  • 53abba3: 8309499: javac fails to report compiler.err.no.java.lang with annotation processing enabled
  • cf8d0b0: 8309964: Use directed inheritDoc for javax.lang.model API
  • a45f929: 8310076: Reduce inclusion of bytecodeStream.hpp
  • 21f6d83: 8309471: Limit key characters in static index pages
  • 44a8aa0: 8308609: java/lang/ScopedValue/StressStackOverflow.java fails with "-XX:-VMContinuations"
  • b412fc7: 8309937: Add @sealedGraph for some Panama FFM interfaces
  • fb024fd: 8248149: G1: change _cleaning_claimed from int to bool
  • ... and 15 more: https://git.openjdk.org/jdk/compare/3e0bbd290c534b0f9729c54cd45308d505907797...master

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 ready Pull request is ready to be integrated label Jun 16, 2023
@justin-curtis-lu
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 20, 2023

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

  • 99d2a9a: 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup
  • 31b6fd7: 8309258: RISC-V: Add riscv_hwprobe syscall
  • 4a9cc8a: 8309266: C2: assert(final_con == (jlong)final_int) failed: final value should be integer
  • 4e4e586: 8310194: Generational ZGC: Lock-order asserts in JVMTI IterateThroughHeap
  • e1906e7: 8310027: Fix -Wconversion warnings in nmethod and compiledMethod related code
  • 4ca548f: 8310326: Incorrect position of the synthetic unnamed class
  • a059576: 8310187: Improve Generational ZGC jtreg testing
  • 9a68ec8: 8219357: G1: G1GCPhaseTimes::debug_phase uses unnecessary ResourceMark
  • 0878872: 8310020: MacroAssembler::call_VM(_leaf) doesn't consistently check for conflict with C calling convention.
  • 79069c5: 8310314: Misplaced "unnamed classes are a preview feature and are disabled by default" error
  • ... and 44 more: https://git.openjdk.org/jdk/compare/3e0bbd290c534b0f9729c54cd45308d505907797...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 20, 2023

@justin-curtis-lu Pushed as commit 09174e0.

💡 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

i18n i18n-dev@openjdk.org integrated Pull request has been integrated nio nio-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

3 participants