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/09/12 13:47:46 UTC

(commons-jxpath) 07/27: Use lambdas

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-jxpath.git

commit ee47f115b0a058d2814fa66b0db258e6545275fe
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Sep 12 09:41:41 2024 -0400

    Use lambdas
---
 .../jxpath/ri/compiler/CoreFunctionTest.java       | 24 +++++-----------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/src/test/java/org/apache/commons/jxpath/ri/compiler/CoreFunctionTest.java b/src/test/java/org/apache/commons/jxpath/ri/compiler/CoreFunctionTest.java
index 4610d25..1901097 100644
--- a/src/test/java/org/apache/commons/jxpath/ri/compiler/CoreFunctionTest.java
+++ b/src/test/java/org/apache/commons/jxpath/ri/compiler/CoreFunctionTest.java
@@ -21,10 +21,8 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.apache.commons.jxpath.ExtendedKeyManager;
-import org.apache.commons.jxpath.IdentityManager;
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.JXPathTestCase;
-import org.apache.commons.jxpath.KeyManager;
 import org.apache.commons.jxpath.NodeSet;
 import org.apache.commons.jxpath.Pointer;
 import org.apache.commons.jxpath.TestMixedModelBean;
@@ -119,13 +117,10 @@ public class CoreFunctionTest extends JXPathTestCase {
     }
 
     public void testIDFunction() {
-        context.setIdentityManager(new IdentityManager() {
-            @Override
-            public Pointer getPointerByID(final JXPathContext context, final String id) {
-                NodePointer ptr = (NodePointer) context.getPointer("/document");
-                ptr = ptr.getValuePointer();
-                return ptr.getPointerByID(context, id);
-            }
+        context.setIdentityManager((context, id) -> {
+            NodePointer ptr = (NodePointer) context.getPointer("/document");
+            ptr = ptr.getValuePointer();
+            return ptr.getPointerByID(context, id);
         });
 
         assertXPathValueAndPointer(
@@ -141,16 +136,7 @@ public class CoreFunctionTest extends JXPathTestCase {
     }
 
     public void testKeyFunction() {
-        context.setKeyManager(new KeyManager() {
-            @Override
-            public Pointer getPointerByKey(
-                final JXPathContext context,
-                final String key,
-                final String value)
-            {
-                return NodePointer.newNodePointer(null, "42", null);
-            }
-        });
+        context.setKeyManager((context, key, value) -> NodePointer.newNodePointer(null, "42", null));
 
         assertXPathValue(context, "key('a', 'b')", "42");
     }