You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/07/08 21:38:00 UTC

[tomcat] branch main updated: Slightly more interesting test case

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

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new cd6be41  Slightly more interesting test case
cd6be41 is described below

commit cd6be41aa22e9ceda43089ddeab98dc79cc9be7b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jul 8 22:37:50 2021 +0100

    Slightly more interesting test case
---
 test/org/apache/el/lang/TestELSupport.java | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/org/apache/el/lang/TestELSupport.java b/test/org/apache/el/lang/TestELSupport.java
index 672afd5..2cf1217 100644
--- a/test/org/apache/el/lang/TestELSupport.java
+++ b/test/org/apache/el/lang/TestELSupport.java
@@ -19,6 +19,7 @@ package org.apache.el.lang;
 import java.beans.PropertyEditorManager;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.util.function.BiPredicate;
 import java.util.function.Predicate;
 
 import jakarta.el.ELException;
@@ -324,6 +325,15 @@ public class TestELSupport {
     }
 
 
+    @Test
+    public void testCoercetoFunctionalInterface06() throws Exception {
+        final ELProcessor elp = new ELProcessor();
+        elp.defineFunction("", "", "org.apache.el.lang.TestELSupport", "testBiPredicateA");
+        Object result = elp.eval("testBiPredicateA((x,y) -> x.name().equals('VALA1') && y)");
+        Assert.assertEquals("PASS", result);
+    }
+
+
     public static String testPredicateA(Predicate<String> filter) {
         String s = "data";
         if (filter.test(s)) {
@@ -352,4 +362,14 @@ public class TestELSupport {
             return "BLOCK";
         }
     }
+
+
+    public static String testBiPredicateA(BiPredicate<TestEnumC,Boolean> filter) {
+        // Mainly interested in if these coerce correctly
+        if (filter.test(TestEnumC.VALA1, Boolean.TRUE)) {
+            return "PASS";
+        } else {
+            return "BLOCK";
+        }
+    }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org