Skip to content

Commit 9250294

Browse files
Cleanups.
1 parent 448c06b commit 9250294

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jfr/TestGarbageCollectionEvents.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2022, 2022, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2022, 2022, Red Hat Inc. All rights reserved.
2+
* Copyright (c) 2025, 2025, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2025, 2025, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -26,16 +26,20 @@
2626

2727
package com.oracle.svm.test.jfr;
2828

29-
import com.oracle.svm.core.jfr.JfrEvent;
30-
import jdk.jfr.Recording;
31-
import jdk.jfr.consumer.RecordedEvent;
32-
import org.junit.Test;
29+
import static org.junit.Assert.assertFalse;
30+
import static org.junit.Assert.assertNotNull;
31+
import static org.junit.Assert.assertTrue;
3332

3433
import java.util.HashSet;
3534
import java.util.List;
3635
import java.util.Set;
3736

38-
import static org.junit.Assert.assertTrue;
37+
import org.junit.Test;
38+
39+
import com.oracle.svm.core.jfr.JfrEvent;
40+
41+
import jdk.jfr.Recording;
42+
import jdk.jfr.consumer.RecordedEvent;
3943

4044
public class TestGarbageCollectionEvents extends JfrRecordingTest {
4145
@Test
@@ -49,15 +53,14 @@ public void test() throws Throwable {
4953
}
5054

5155
private static void validateEvents(List<RecordedEvent> events) {
52-
assertTrue(events.size() > 0);
56+
assertFalse(events.isEmpty());
5357
int foundSystemGc = 0;
5458
Set<Integer> ids = new HashSet<>();
5559
for (RecordedEvent event : events) {
56-
assertTrue(!ids.contains(event.getInt("gcId")));
57-
ids.add(event.getInt("gcId"));
58-
assertTrue(event.getThread("eventThread").getJavaName() != null);
59-
assertTrue(!event.getDuration().isZero());
60-
assertTrue(event.getString("name") != null);
60+
assertTrue(ids.add(event.getInt("gcId")));
61+
assertNotNull(event.getThread("eventThread").getJavaName());
62+
assertFalse(event.getDuration().isZero());
63+
assertNotNull(event.getString("name"));
6164
assertTrue(event.getLong("longestPause") > 0);
6265
assertTrue(event.getLong("sumOfPauses") > 0);
6366
if (event.getString("cause").equals("java.lang.System.gc()")) {

0 commit comments

Comments
 (0)