Fix sonar issue in performance test ResourceMeter

Replace busy loop with await().until as suggested by sonar

Issue-ID: CPS-89
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: Ic6c870c419a67708082ceb05ef3ccba884ae375e
diff --git a/integration-test/src/test/java/org/onap/cps/integration/ResourceMeter.java b/integration-test/src/test/java/org/onap/cps/integration/ResourceMeter.java
index f8a2ecb..46bfcf6 100644
--- a/integration-test/src/test/java/org/onap/cps/integration/ResourceMeter.java
+++ b/integration-test/src/test/java/org/onap/cps/integration/ResourceMeter.java
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2023 Nordix Foundation
+ *  Copyright (C) 2023-2024 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the 'License');
  *  you may not use this file except in compliance with the License.
@@ -20,6 +20,8 @@
 
 package org.onap.cps.integration;
 
+import static org.awaitility.Awaitility.await;
+
 import java.lang.management.GarbageCollectorMXBean;
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryPoolMXBean;
@@ -71,7 +73,7 @@
     static void performGcAndWait() {
         final long gcCountBefore = getGcCount();
         System.gc();
-        while (getGcCount() == gcCountBefore) {}
+        await().until(() -> getGcCount() > gcCountBefore);
     }
 
     private static long getGcCount() {
@@ -94,4 +96,3 @@
                 .forEach(MemoryPoolMXBean::resetPeakUsage);
     }
 }
-