@@ -74,21 +74,18 @@ public void testInspectorActionsIntegration() {
7474 inspectorActions .enableInspectorAsync (null ).join ();
7575
7676 List <String > allFindings = inspectorActions .listLowSeverityFindingsAsync ().join ();
77+ if (!allFindings .isEmpty ()) {
78+ // Only proceed if there are findings
79+ String lastArn = allFindings .get (allFindings .size () - 1 );
80+ logger .info ("Fetching details for last finding ARN: {}" , lastArn );
7781
78- if (allFindings .isEmpty ()) {
79- logger .info ("No LOW severity findings found." );
80- } else {
81- logger .info ("Found {} LOW severity findings." , allFindings .size ());
82-
83- // Optionally, iterate over all findings to test getFindingDetailsAsync
84- for (String arn : allFindings ) {
85- logger .info ("Fetching details for finding ARN: {}" , arn );
86- String details = inspectorActions .getFindingDetailsAsync (arn ).join ();
82+ String details = inspectorActions .getFindingDetailsAsync (lastArn ).join ();
8783
88- // Check details are not empty/null
89- assertNotNull (details , "Finding details should not be null" );
90- assertFalse (details .isEmpty (), "Finding details should not be empty" );
91- }
84+ // Check details are not empty/null
85+ assertNotNull (details , "Finding details should not be null" );
86+ assertFalse (details .isEmpty (), "Finding details should not be empty" );
87+ } else {
88+ logger .info ("No LOW severity findings found." );
9289 }
9390
9491 maxResults = 5 ;
0 commit comments