You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/06/01 18:58:25 UTC

(commons-jexl) branch master updated (fc649451 -> b55b42e2)

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

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


    from fc649451 Use assertThrows()
     new 8495eca6 Use assertThrows()
     new 90346352 Inline local variable
     new 79eac56f Use assertThrows()
     new 6c5ead7b Use assertThrows()
     new a3036f84 Fix Checkstyle
     new 70568c21 Clean up imports
     new b55b42e2 Clean up imports

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commons/jexl3/ComposePermissionsTest.java      |  1 +
 .../apache/commons/jexl3/ContextNamespaceTest.java |  1 +
 .../java/org/apache/commons/jexl3/DoWhileTest.java |  4 ++--
 .../org/apache/commons/jexl3/FeaturesTest.java     |  9 ++------
 .../java/org/apache/commons/jexl3/ForEachTest.java | 24 ++++++++--------------
 src/test/java/org/apache/commons/jexl3/IfTest.java | 12 +++--------
 6 files changed, 17 insertions(+), 34 deletions(-)


(commons-jexl) 06/07: Clean up imports

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 70568c2111841f7c69469d170c828572c52fd7ff
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 1 14:58:06 2024 -0400

    Clean up imports
---
 src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java b/src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java
index ae54830f..4a8bb87e 100644
--- a/src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java
+++ b/src/test/java/org/apache/commons/jexl3/ContextNamespaceTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.jexl3;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;


(commons-jexl) 02/07: Inline local variable

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 903463529b35c1434dc6f1419422ee94aba48a99
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 1 14:53:54 2024 -0400

    Inline local variable
---
 src/test/java/org/apache/commons/jexl3/FeaturesTest.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/jexl3/FeaturesTest.java b/src/test/java/org/apache/commons/jexl3/FeaturesTest.java
index 99760669..ae8a6fda 100644
--- a/src/test/java/org/apache/commons/jexl3/FeaturesTest.java
+++ b/src/test/java/org/apache/commons/jexl3/FeaturesTest.java
@@ -64,8 +64,7 @@ public class FeaturesTest extends JexlTestCase {
             final JexlScript ctl = JEXL.createScript(script);
             assertNotNull(ctl);
             final JexlException.Parsing xfeature = assertThrows(JexlException.Parsing.class, () -> jexl.createScript(features, null, script));
-            final String msg = xfeature.getMessage();
-            assertNotNull(msg);
+            assertNotNull(xfeature.getMessage());
         }
     }
 


(commons-jexl) 04/07: Use assertThrows()

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6c5ead7bae32573a1b02a1692e861d13f93e15c4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 1 14:57:10 2024 -0400

    Use assertThrows()
---
 src/test/java/org/apache/commons/jexl3/IfTest.java | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/test/java/org/apache/commons/jexl3/IfTest.java b/src/test/java/org/apache/commons/jexl3/IfTest.java
index ce4e4047..26ae06d1 100644
--- a/src/test/java/org/apache/commons/jexl3/IfTest.java
+++ b/src/test/java/org/apache/commons/jexl3/IfTest.java
@@ -18,8 +18,8 @@ package org.apache.commons.jexl3;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 
 import org.junit.jupiter.api.Test;
 
@@ -307,16 +307,10 @@ public class IfTest extends JexlTestCase {
         final JexlEvalContext jc = new JexlEvalContext();
         final JexlOptions options = jc.getEngineOptions();
         final JexlExpression e = JEXL.createExpression("false ? bar : quux");
-        Object o;
         options.setStrict(true);
         options.setSilent(false);
-        try {
-           o = e.evaluate(jc);
-           fail("Should have failed");
-        } catch (final JexlException xjexl) {
-           // OK
-           assertTrue(xjexl.toString().contains("quux"));
-        }
+        final JexlException xjexl = assertThrows(JexlException.class, () -> e.evaluate(jc));
+        assertTrue(xjexl.toString().contains("quux"));
     }
 
     /**


(commons-jexl) 05/07: Fix Checkstyle

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a3036f84b2cfd1a65694593a7590c97397b896ad
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 1 14:57:41 2024 -0400

    Fix Checkstyle
---
 src/test/java/org/apache/commons/jexl3/DoWhileTest.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/jexl3/DoWhileTest.java b/src/test/java/org/apache/commons/jexl3/DoWhileTest.java
index bd49e182..9ca18c77 100644
--- a/src/test/java/org/apache/commons/jexl3/DoWhileTest.java
+++ b/src/test/java/org/apache/commons/jexl3/DoWhileTest.java
@@ -64,8 +64,8 @@ public class DoWhileTest extends JexlTestCase {
 
     @Test
     public void testForEachContinueInsideFunction() throws Exception {
-        final JexlException.Parsing xparse = assertThrows(JexlException.Parsing.class, () -> JEXL.createScript("for (i : 1..2) {  y = function() { continue; } }"),
-                "break is out of loop!");
+        final JexlException.Parsing xparse = assertThrows(JexlException.Parsing.class,
+                () -> JEXL.createScript("for (i : 1..2) {  y = function() { continue; } }"), "break is out of loop!");
         final String str = xparse.detailedMessage();
         assertTrue(str.contains("continue"));
     }


(commons-jexl) 03/07: Use assertThrows()

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 79eac56f58c538180cce5d48cdf840d93823fea3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 1 14:55:30 2024 -0400

    Use assertThrows()
---
 .../java/org/apache/commons/jexl3/ForEachTest.java | 24 ++++++++--------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/test/java/org/apache/commons/jexl3/ForEachTest.java b/src/test/java/org/apache/commons/jexl3/ForEachTest.java
index b4a3adcf..a8b65357 100644
--- a/src/test/java/org/apache/commons/jexl3/ForEachTest.java
+++ b/src/test/java/org/apache/commons/jexl3/ForEachTest.java
@@ -19,9 +19,8 @@ package org.apache.commons.jexl3;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -44,13 +43,10 @@ public class ForEachTest extends JexlTestCase {
 
     @Test
     public void testForEachBreakBroken() throws Exception {
-        try {
-            final JexlScript e = JEXL.createScript("if (true) { break; }");
-            fail("break is out of loop!");
-        } catch (final JexlException.Parsing xparse) {
-            final String str = xparse.detailedMessage();
-            assertTrue(str.contains("break"));
-        }
+        final JexlException.Parsing xparse = assertThrows(JexlException.Parsing.class, () -> JEXL.createScript("if (true) { break; }"),
+                "break is out of loop!");
+        assertTrue(xparse.detailedMessage().contains("break"));
+
     }
 
     @Test
@@ -66,13 +62,9 @@ public class ForEachTest extends JexlTestCase {
 
     @Test
     public void testForEachContinueBroken() throws Exception {
-        try {
-            final JexlScript e = JEXL.createScript("var rr = 0; continue;");
-            fail("continue is out of loop!");
-        } catch (final JexlException.Parsing xparse) {
-            final String str = xparse.detailedMessage();
-            assertTrue(str.contains("continue"));
-        }
+        final JexlException.Parsing xparse = assertThrows(JexlException.Parsing.class, () -> JEXL.createScript("var rr = 0; continue;"),
+                "continue is out of loop!");
+        assertTrue(xparse.detailedMessage().contains("continue"));
     }
 
     @Test


(commons-jexl) 01/07: Use assertThrows()

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8495eca6167668e36fac77bee5345053e92e9d8b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 1 14:53:29 2024 -0400

    Use assertThrows()
---
 src/test/java/org/apache/commons/jexl3/FeaturesTest.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/commons/jexl3/FeaturesTest.java b/src/test/java/org/apache/commons/jexl3/FeaturesTest.java
index c211d9e3..99760669 100644
--- a/src/test/java/org/apache/commons/jexl3/FeaturesTest.java
+++ b/src/test/java/org/apache/commons/jexl3/FeaturesTest.java
@@ -63,13 +63,9 @@ public class FeaturesTest extends JexlTestCase {
         for (final String script : scripts) {
             final JexlScript ctl = JEXL.createScript(script);
             assertNotNull(ctl);
-            try {
-                final JexlScript e = jexl.createScript(features, null, script);
-                fail("should fail parse: " + script);
-            } catch (final JexlException.Parsing xfeature) {
-                final String msg = xfeature.getMessage();
-                assertNotNull(msg);
-            }
+            final JexlException.Parsing xfeature = assertThrows(JexlException.Parsing.class, () -> jexl.createScript(features, null, script));
+            final String msg = xfeature.getMessage();
+            assertNotNull(msg);
         }
     }
 


(commons-jexl) 07/07: Clean up imports

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b55b42e266e2e1748acc8640298dcceb54cc4a30
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jun 1 14:58:19 2024 -0400

    Clean up imports
---
 src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java b/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java
index d3ff5e7c..6d1324d6 100644
--- a/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java
+++ b/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.jexl3;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+
 import java.io.File;
 import java.io.FileReader;
 import java.util.Collections;