JDK-8160564 : TEST: Add a test to check the implementation of VersionProps.versionNumbers()
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-06-29
  • Updated: 2016-07-26
  • Resolved: 2016-07-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b128Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The code in VersionProps.versionNumbers() could be slightly refactored in order to  provide an entry point for unit testing:

...
class VersionProps {
  . . .
  static List<Integer> parseVersionNumbers(String versionNumber) {
      // parsing code goes there
  }
  static List<Integer> versionNumbers() {
      return parseVersionNumbers(VERSION_NUMBER);
  }
  . . .
}
...

This would allow writing/adding a unit test for the algorithm implemented in parseVersionNumbers (either using white-box with -Xpatch or using reflection and the proper incantations to invoke parseVersionNumbers from outside the package).