This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch v3
in repository https://gitbox.apache.org/repos/asf/causeway.git


The following commit(s) were added to refs/heads/v3 by this push:
     new fba72385f4c CAUSEWAY-3972: fixes test in prev. commit
fba72385f4c is described below

commit fba72385f4c0e4f2db7559203874b2a6f223a9ec
Author: andi-huber <[email protected]>
AuthorDate: Wed Mar 4 17:13:39 2026 +0100

    CAUSEWAY-3972: fixes test in prev. commit
---
 .../apache/causeway/commons/internal/base/_OneshotTest.java    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/commons/src/test/java/org/apache/causeway/commons/internal/base/_OneshotTest.java
 
b/commons/src/test/java/org/apache/causeway/commons/internal/base/_OneshotTest.java
index a5ef79e95d3..baad496f020 100644
--- 
a/commons/src/test/java/org/apache/causeway/commons/internal/base/_OneshotTest.java
+++ 
b/commons/src/test/java/org/apache/causeway/commons/internal/base/_OneshotTest.java
@@ -18,10 +18,12 @@
  */
 package org.apache.causeway.commons.internal.base;
 
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.atomic.LongAdder;
 
 import org.junit.jupiter.api.Test;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.fail;
 
 import lombok.SneakyThrows;
@@ -30,23 +32,27 @@ class _OneshotTest {
 
     final _Oneshot oneshot = new _Oneshot();
     final LongAdder counter = new LongAdder();
+    final AtomicReference<String> errors = new AtomicReference<>();
 
     @Test
     void test() {
         oneshot.trigger(this::sayHelloOnce);
+        assertEquals(1, counter.intValue());
+        assertEquals(null, errors.get());
     }
 
     @SneakyThrows
     void sayHelloOnce() {
         if(counter.intValue()>0) {
+            errors.set("recursion detected");
             fail("recursion detected");
         }
 
         counter.increment();
 
         // calling 'sayHelloOnce' from a different thread, while still 
executing in the main thread,
-        // must not lead to a recursions
-        var thread = new Thread(this::sayHelloOnce);
+        // must not lead to a recursion
+        var thread = new Thread(()->oneshot.trigger(this::sayHelloOnce));
         thread.start();
         thread.join();
     }

Reply via email to