RFR: 8308803: Improve java/util/UUID/UUIDTest.java [v2]
Aleksey Shipilev
shade at openjdk.org
Wed May 31 14:53:10 UTC 2023
On Wed, 31 May 2023 14:17:40 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> Two thoughts here. The random number source (SecureRandom) should have its own tests, UUID has a simple dependency on a generator. The test for UUID is that it composes the bits into the UUID correctly. The randomness of the generator should be factored out.
This test verifies the way UUID uses the SecureRandom. Think about this as the less of a unit, and more of the integration test. This would be even more important once things like https://bugs.openjdk.org/browse/JDK-8308804 show up.
> Second, to raise concern about collisions, then the test should not throw on the first detected collision but complete the cycle and provide the simple stats on the number of collisions per COUNT (1,000,000).
All right, that we can do. See new commit.
> All those 5 second test runs add up.
Yes, and it would be sad to waste those 5 seconds on something irrelevant. I would argue that `UUID.randomUUID` breakage would be very unfortunate for the real world systems. Spending 5 seconds per test run on it is a good investment here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14134#discussion_r1211842661
More information about the core-libs-dev
mailing list