You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2020/11/02 12:12:20 UTC

[commons-jexl] branch master updated: JEXL-288: fixing travis, test may fail when running on single threaded env Task #JEXL-288 - Annotation can not be specified for a standalone statement

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

henrib pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git


The following commit(s) were added to refs/heads/master by this push:
     new c81db74  JEXL-288: fixing travis, test may fail when running on single threaded env Task #JEXL-288 - Annotation can not be specified for a standalone statement
c81db74 is described below

commit c81db74a44b9a39a714140bc988031ce9c0a74d4
Author: henrib <he...@apache.org>
AuthorDate: Mon Nov 2 13:11:03 2020 +0100

    JEXL-288: fixing travis, test may fail when running on single threaded env
    Task #JEXL-288 - Annotation can not be specified for a standalone statement
---
 src/test/java/org/apache/commons/jexl3/AnnotationTest.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/jexl3/AnnotationTest.java b/src/test/java/org/apache/commons/jexl3/AnnotationTest.java
index e9ea1cb..bac0273 100644
--- a/src/test/java/org/apache/commons/jexl3/AnnotationTest.java
+++ b/src/test/java/org/apache/commons/jexl3/AnnotationTest.java
@@ -348,8 +348,12 @@ public class AnnotationTest extends JexlTestCase {
             }
             executor.shutdown();
             executor.awaitTermination(5, TimeUnit.SECONDS);
-            Assert.assertEquals(NUM_THREADS * NUM_ITERATIONS, syncCounter.getValue());
-            Assert.assertNotEquals(NUM_THREADS * NUM_ITERATIONS, concCounter.getValue());
+            // this may succeed concurrently if there is only one 'real' thread
+            // during execution; we can only prove the 'synchronized' if the unsync-ed
+            // version fails...
+            if (NUM_THREADS * NUM_ITERATIONS != concCounter.getValue()) {
+                Assert.assertEquals(NUM_THREADS * NUM_ITERATIONS, syncCounter.getValue());
+            }
         }
     }