diff --git a/org.eclipse.scout.rt.platform.test/src/test/java/org/eclipse/scout/rt/platform/opentelemetry/PeriodicAsyncMeasurementTest.java b/org.eclipse.scout.rt.platform.test/src/test/java/org/eclipse/scout/rt/platform/opentelemetry/PeriodicAsyncMeasurementTest.java index a50504d4409..f8a4888ea2e 100644 --- a/org.eclipse.scout.rt.platform.test/src/test/java/org/eclipse/scout/rt/platform/opentelemetry/PeriodicAsyncMeasurementTest.java +++ b/org.eclipse.scout.rt.platform.test/src/test/java/org/eclipse/scout/rt/platform/opentelemetry/PeriodicAsyncMeasurementTest.java @@ -220,7 +220,10 @@ public void testActiveOnThisNode() throws Exception { final long asyncObservationInterval = 100; Callable callable = mockCallable(); - Mockito.when(callable.call()).thenReturn(111L); + Mockito.when(callable.call()).then(invocation -> { + Thread.sleep(3); // simulate "db access" + return 111L; + }); AtomicBoolean activeOnThisNode = new AtomicBoolean(false); try (PeriodicAsyncMeasurement asyncMeasurement = new PeriodicAsyncMeasurement<>("testActiveOnThisNode", callable, () -> RunContexts.empty(), () -> activeOnThisNode.get(), asyncObservationInterval)) { @@ -238,7 +241,6 @@ public void testActiveOnThisNode() throws Exception { assertNull(asyncMeasurement.getAndNext()); assertAsyncJobTrigger(callable, 0); - Thread.sleep(20); activeOnThisNode.set(Boolean.TRUE); // forth observation --> no measurement, but trigger async job