From a6e5e6fb0a8f4eb77ec8016e7f0e8886a3cbfca7 Mon Sep 17 00:00:00 2001 From: Robert Toyonaga Date: Mon, 30 Mar 2026 09:57:54 -0400 Subject: [PATCH] use Asserts.assertNotNull rather than AssertionError --- .../streaming/TestRepositoryFilesRescan.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryFilesRescan.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryFilesRescan.java index fce89b81bb1..0cb80d18698 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryFilesRescan.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestRepositoryFilesRescan.java @@ -27,6 +27,7 @@ import java.nio.file.Path; import jdk.jfr.Recording; import jdk.jfr.internal.consumer.RepositoryFiles; +import jdk.test.lib.Asserts; /** * @test @@ -57,22 +58,15 @@ public class TestRepositoryFilesRescan { */ private static void testNoOscillation(Path dir) { RepositoryFiles rf = new RepositoryFiles(dir, false); - if (rf.firstPath(0, false) == null) { - throw new AssertionError("Call 1: expected non-null (initial discovery of .jfr files)"); - } + Asserts.assertNotNull(rf.firstPath(0, false), "Call 1: expected non-null (initial discovery of .jfr files)"); Path p2 = rf.firstPath(0, false); - if (p2 != null) { - throw new AssertionError("Call 2: expected null (no new chunks), got " + p2); - } + Asserts.assertNull(p2, "Call 2: expected null (no new chunks), got " + p2); // Call 3: still no new files. This confirms call 2 did not wipe pathLookup, making all files look "new" again. Path p3 = rf.firstPath(0, false); - if (p3 != null) { - throw new AssertionError( - "Call 3: expected null (no new chunks), got " + p3 - + " — pathLookup is oscillating between populated and empty"); - } + Asserts.assertNull(p3, "Call 3: expected null (no new chunks), got " + p3 + + " — pathLookup is oscillating between populated and empty"); } private static void createChunkFile(Path dir, String name) throws Exception {