Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8290836 Improve test coverage for XPath functions: String Functions #9752

Closed
wants to merge 5 commits into from

Conversation

bwhuang-us
Copy link
Contributor

@bwhuang-us bwhuang-us commented Aug 4, 2022

Improve test coverage for XPath functions: JDK-8290836, JDK-8290837, JDK-8290838.


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-8290836: Improve test coverage for XPath functions: String Functions
  • JDK-8290837: Improve test coverage for XPath functions: Boolean Functions
  • JDK-8290838: Improve test coverage for XPath functions: Number Functions

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9752

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 4, 2022

👋 Welcome back bwhuang-us! 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.

@bwhuang-us
Copy link
Contributor Author

/issue add JDK-8290837, JDK-8290838

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 4, 2022
@openjdk
Copy link

openjdk bot commented Aug 4, 2022

@bwhuang-us
Adding additional issue to issue list: 8290837: Improve test coverage for XPath functions: Boolean Functions.

Adding additional issue to issue list: 8290838: Improve test coverage for XPath functions: Number Functions.

@openjdk
Copy link

openjdk bot commented Aug 4, 2022

@bwhuang-us 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 core-libs core-libs-dev@openjdk.org label Aug 4, 2022
@mlbridge
Copy link

mlbridge bot commented Aug 4, 2022

Webrevs

Copy link
Member

@JoeWang-Java JoeWang-Java left a comment

Choose a reason for hiding this comment

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

Overall, nice set of tests!

I see you've covering three issues, sth. I don't have experience with, so let's see what happens. It might be that the tests have different bug id associated with them, not much of an issue as this is a test enhancement.

See comments below.


/*
* DataProvider for testing TransformerException being thrown on
* invalid number function usage.
Copy link
Member

Choose a reason for hiding this comment

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

I think you meant XPathExpressionException instead of TransformerException.

Typo: s/number/boolean

This comment applies to other occurrences as well.

*/
@DataProvider(name = "exceptionExpTestCases")
public Object[][] getExceptionExp() {
return new Object[][]{
Copy link
Member

Choose a reason for hiding this comment

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

Applies to DataProviders for exception testing: would be good to add some notes about the data, e.g. why they are invalid.

* @throws Exception if test fails
*/
@Test(dataProvider = "exceptionExpTestCases", expectedExceptions =
XPathExpressionException.class)
Copy link
Member

Choose a reason for hiding this comment

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

expectedExceptions is fine in this case. But there's a preference in using assertThrows in general. I'll leave it to you to decide.

*/
@Test(dataProvider = "numberExpTestCases")
void testNumberFn(String exp, double expected) throws Exception {
testExp(doc, exp, expected, Double.class);
Copy link
Member

Choose a reason for hiding this comment

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

Besides Double, Integer and Long are also supported. It's ok though as the focus here is on the XPath expressions. If you want to add a few cases, that would be good too.

@@ -77,16 +79,20 @@ class XPathTestBase {
+ " <City>The City</City>"
+ " <State>The State</State>"
+ " </Address>"
+ " <Age>0</Age>"
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any issue in the test cases themselves. But the ages being 0, 1, -1 makes it slightly less readable because they can be confused with the number of nodes in the nodeset, even number(true()) as that also returns 1. It could be sth. that leads to mistakes. I would set the ages > 1, or actually greater than the number of nodes possibly returned.

Copy link
Member

@JoeWang-Java JoeWang-Java 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 update.

@openjdk
Copy link

openjdk bot commented Aug 9, 2022

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

8290836: Improve test coverage for XPath functions: String Functions
8290837: Improve test coverage for XPath functions: Boolean Functions
8290838: Improve test coverage for XPath functions: Number Functions

Reviewed-by: joehw

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 90 new commits pushed to the master branch:

  • ae1a9a0: 8292060: Make ClassFileVersionTest.java version adapting
  • 4040927: 8290047: (fs) FileSystem.getPathMatcher does not check for ":" at last index
  • 8d0d9ea: 8291238: JDK can't be built without G1
  • aff7689: 8292075: Remove deleted test compiler/rangechecks/TestRangeCheckHoistingScaledIV.java from ProblemList
  • 3677b55: 6391806: JLabel and AbstractButton's imageUpdate method should be better specified
  • 0ade264: 8290814: Hide G1RootRegions behind G1ConcurrentMark
  • f5b3618: 8291970: Add TableStatistics get function to ResourceHashtable
  • cbc9040: 8290278: JavaDoc of index parameter of method JTabbedPane.insertTab
  • 2712bc3: 8289741: Remove unused imports from DTDBuilder.java
  • af243ca: 8265433: IGV: add graph tooltips with properties
  • ... and 80 more: https://git.openjdk.org/jdk/compare/57bf603b7332db86c39680d16b78f94a904daf46...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@JoeWang-Java) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 9, 2022
@bwhuang-us
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Aug 9, 2022
@openjdk
Copy link

openjdk bot commented Aug 9, 2022

@bwhuang-us
Your change (at version 9bdb167) is now ready to be sponsored by a Committer.

@JoeWang-Java
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Aug 9, 2022

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

  • ae1a9a0: 8292060: Make ClassFileVersionTest.java version adapting
  • 4040927: 8290047: (fs) FileSystem.getPathMatcher does not check for ":" at last index
  • 8d0d9ea: 8291238: JDK can't be built without G1
  • aff7689: 8292075: Remove deleted test compiler/rangechecks/TestRangeCheckHoistingScaledIV.java from ProblemList
  • 3677b55: 6391806: JLabel and AbstractButton's imageUpdate method should be better specified
  • 0ade264: 8290814: Hide G1RootRegions behind G1ConcurrentMark
  • f5b3618: 8291970: Add TableStatistics get function to ResourceHashtable
  • cbc9040: 8290278: JavaDoc of index parameter of method JTabbedPane.insertTab
  • 2712bc3: 8289741: Remove unused imports from DTDBuilder.java
  • af243ca: 8265433: IGV: add graph tooltips with properties
  • ... and 80 more: https://git.openjdk.org/jdk/compare/57bf603b7332db86c39680d16b78f94a904daf46...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Aug 9, 2022
@openjdk openjdk bot closed this Aug 9, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Aug 9, 2022
@openjdk
Copy link

openjdk bot commented Aug 9, 2022

@JoeWang-Java @bwhuang-us Pushed as commit d889264.

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

@bwhuang-us bwhuang-us deleted the JDK-8290836 branch March 1, 2023 18:24
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
2 participants