1
1
/*
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.
4
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
5
*
6
6
* This code is free software; you can redistribute it and/or modify it
26
26
27
27
package com .oracle .svm .test .jfr ;
28
28
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 ;
33
32
34
33
import java .util .HashSet ;
35
34
import java .util .List ;
36
35
import java .util .Set ;
37
36
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 ;
39
43
40
44
public class TestGarbageCollectionEvents extends JfrRecordingTest {
41
45
@ Test
@@ -49,15 +53,14 @@ public void test() throws Throwable {
49
53
}
50
54
51
55
private static void validateEvents (List <RecordedEvent > events ) {
52
- assertTrue (events .size () > 0 );
56
+ assertFalse (events .isEmpty () );
53
57
int foundSystemGc = 0 ;
54
58
Set <Integer > ids = new HashSet <>();
55
59
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" ));
61
64
assertTrue (event .getLong ("longestPause" ) > 0 );
62
65
assertTrue (event .getLong ("sumOfPauses" ) > 0 );
63
66
if (event .getString ("cause" ).equals ("java.lang.System.gc()" )) {
0 commit comments