Repository: primefaces/primefaces (java)

Issue:
Datatable: Default filter feature broken in showcase with PF15
### Describe the bug

While doing some manual testing for the JS refactor PR, I noticed the default filter feature from the showcase is broken and throws an exception.

### Reproducer

* Fetch the lastest state of the master branch (I used ccfd6d682d8041fd01a7af50c0fdaadde91e8d10), start the showcase and goto the data table filter feature page: http://localhost:8081/showcase/ui/data/datatable/filter.xhtml
* Scroll down to `Default Filter`
* Attempt to use any of the filter. E.g. I clicked in the filter at the top of the `Country` column and entered `Spain`

This results in a generic error page with the following stacktrace:

```
Dec 08, 2024 2:03:26 PM org.primefaces.application.exceptionhandler.PrimeExceptionHandler logException
SEVERE: Filter 'NEW' of type 'java.lang.String' cannot be casted to value type 'NEGOTIATION'. Forgot to add a converter?
java.lang.IllegalArgumentException: Filter 'NEW' of type 'java.lang.String' cannot be casted to value type 'NEGOTIATION'. Forgot to add a converter?
	at org.primefaces.model.filter.ComparableFilterConstraint.assertAssignable(ComparableFilterConstraint.java:57)
	at org.primefaces.model.filter.EqualsFilterConstraint.isMatching(EqualsFilterConstraint.java:44)
	at org.primefaces.component.datatable.feature.FilterFeature.lambda$filter$0(FilterFeature.java:153)
	at org.primefaces.component.api.ColumnAware.forEachColumn(ColumnAware.java:102)
	at org.primefaces.component.api.ColumnAware.forEachColumn(ColumnAware.java:55)
	at org.primefaces.component.api.ColumnAware.forEachColumn(ColumnAware.java:51)
	at org.primefaces.component.datatable.feature.FilterFeature.filter(FilterFeature.java:132)
	at org.primefaces.component.datatable.feature.FilterFeature.encode(FilterFeature.java:94)
	at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:93)
	at jakarta.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:586)
	at jakarta.faces.component.UIComponent.encodeAll(UIComponent.java:1442)
	at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:624)
	at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:158)
	at jakarta.faces.component.visit.VisitContextWrapper.invokeVisitCallback(VisitContextWrapper.java:92)
	at org.primefaces.component.api.PrimeUIData$VisitContextImpl.invokeVisitCallback(PrimeUIData.java:508)
	at org.primefaces.component.patch.UIDataPatch.visitTree(UIDataPatch.java:877)
	at org.primefaces.component.api.PrimeUIData.visitTree(PrimeUIData.java:292)
	at jakarta.faces.component.UIComponent.visitTree(UIComponent.java:1278)
	at jakarta.faces.component.UIForm.visitTree(UIForm.java:344)
	at jakarta.faces.component.UIComponent.visitTree(UIComponent.java:1278)
	at jakarta.faces.component.UIComponent.visitTree(UIComponent.java:1278)
	at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:394)
	at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:312)
	at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:61)
	at jakarta.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1092)
	at jakarta.faces.component.UIComponent.encodeAll(UIComponent.java:1435)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:422)
	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:160)
	at jakarta.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:125)
	at jakarta.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:125)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:93)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:72)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:150)
	at jakarta.faces.lifecycle.LifecycleWrapper.render(LifecycleWrapper.java:91)
	at jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:692)
	at jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:449)
	at org.eclipse.jetty.ee10.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1379)
	at org.eclipse.jetty.ee10.servlet.ServletHolder.handle(ServletHolder.java:736)
	at org.eclipse.jetty.ee10.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1614)
	at org.primefaces.webapp.filter.NoCacheFilter.doFilter(NoCacheFilter.java:50)
	at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:205)
	at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1586)
	at org.primefaces.webapp.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:53)
	at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:208)
	at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1586)
	at org.eclipse.jetty.ee10.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:195)
	at org.eclipse.jetty.ee10.servlet.FilterHolder.doFilter(FilterHolder.java:205)
	at org.eclipse.jetty.ee10.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1586)
	at org.eclipse.jetty.ee10.servlet.ServletHandler$MappedServlet.handle(ServletHandler.java:1547)
	at org.eclipse.jetty.ee10.servlet.ServletChannel.dispatch(ServletChannel.java:819)
	at org.eclipse.jetty.ee10.servlet.ServletChannel.handle(ServletChannel.java:436)
	at org.eclipse.jetty.ee10.servlet.ServletHandler.handle(ServletHandler.java:464)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:575)
	at org.eclipse.jetty.ee10.servlet.SessionHandler.handle(SessionHandler.java:717)
	at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1060)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:151)
	at org.eclipse.jetty.server.Server.handle(Server.java:182)
	at org.eclipse.jetty.server.internal.HttpChannelState$HandlerInvoker.run(HttpChannelState.java:662)
	at org.eclipse.jetty.server.internal.HttpConnection.onFillable(HttpConnection.java:418)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:322)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:99)
	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:478)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:441)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:293)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:201)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:311)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:979)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1209)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1164)
	at java.base/java.lang.Thread.run(Thread.java:840)
```

### Expected behavior

No error page should show up, the filter should be applied to the database.  Not sure if PF or the showcase needs to be updated. It works in the [current PF 14 showcase](https://www.primefaces.org/showcase/ui/data/datatable/filter.xhtml)

### PrimeFaces edition

None

### PrimeFaces version

ccfd6d682d8041fd01a7af50c0fdaadde91e8d10

### Theme

_No response_

### JSF implementation

All

### JSF version

2.3.21

### Java version

17

### Browser(s)

_No response_

Pull request:
Fix #13018: EqualsFilterConstraint handle enum/string
Fix #13018: EqualsFilterConstraint handle enum/string

Patch:
diff --git a/primefaces/src/main/java/org/primefaces/component/datatable/DataTableRenderer.java b/primefaces/src/main/java/org/primefaces/component/datatable/DataTableRenderer.java
index dcc8bf97a7..a56e2bd9e1 100644
--- a/primefaces/src/main/java/org/primefaces/component/datatable/DataTableRenderer.java
+++ b/primefaces/src/main/java/org/primefaces/component/datatable/DataTableRenderer.java
@@ -687,7 +687,7 @@ public class DataTableRenderer extends DataRenderer {
             }
         }
 
-        String ariaHeaderLabel = getHeaderLabel(context, column);
+        String ariaHeaderLabel = resolveColumnAriaHeaderText(context, column);
         UIComponent component = (column instanceof UIComponent) ? (UIComponent) column : null;
 
         writer.startElement("th", component);
@@ -751,20 +751,18 @@ public class DataTableRenderer extends DataRenderer {
                 SortMeta sortMeta) throws IOException {
         ResponseWriter writer = context.getResponseWriter();
 
-        UIComponent header = column.getFacet("header");
-        String headerText = column.getHeaderText();
-        String ariaHeaderText = column.getAriaHeaderText();
+        UIComponent headerFacet = column.getFacet("header");
+        String headerText = resolveColumnHeaderText(context, column);
         String titleStyleClass = getStyleClassBuilder(context)
                 .add(DataTable.COLUMN_TITLE_CLASS)
-                .add(LangUtils.isNotBlank(ariaHeaderText), "ui-helper-hidden-accessible")
+                .add(isColumnAriaHeaderTextDefined(context, column), "ui-helper-hidden-accessible")
                 .build();
-        headerText = LangUtils.isNotBlank(headerText) ? headerText : ariaHeaderText;
 
         writer.startElement("span", null);
         writer.writeAttribute("class", titleStyleClass, null);
 
-        if (FacetUtils.shouldRenderFacet(header, table.isRenderEmptyFacets())) {
-            header.encodeAll(context);
+        if (FacetUtils.shouldRenderFacet(headerFacet, table.isRenderEmptyFacets())) {
+            headerFacet.encodeAll(context);
         }
         else if (headerText != null) {
             String title = column.getTitle();
@@ -820,7 +818,7 @@ public class DataTableRenderer extends DataRenderer {
     }
 
     protected void encodeDefaultFilter(FacesContext context, DataTable table, UIColumn column,
-        ResponseWriter writer) throws IOException {
+            ResponseWriter writer) throws IOException {
         String separator = String.valueOf(UINamingContainer.getSeparatorChar(context));
         boolean disableTabbing = table.getScrollWidth() != null;
         String filterId = column.getContainerClientId(context) + separator + "filter";
@@ -1693,14 +1691,7 @@ public class DataTableRenderer extends DataRenderer {
 
             headerLabel.set(null);
             table.invokeOnColumn(sortMeta.getColumnKey(), (column) -> {
-                String label = getHeaderLabel(context, column);
-                if (LangUtils.isBlank(label)) {
-                    UIComponent headerFacet = column.getFacet("header");
-                    if (FacetUtils.shouldRenderFacet(headerFacet)) {
-                        // encode and strip all HTML tags
-                        label = ComponentUtils.encodeComponent(headerFacet, context).replaceAll("\\<.*?\\>", Constants.EMPTY_STRING);
-                    }
-                }
+                String label = resolveColumnAriaHeaderText(context, column);
                 headerLabel.set(label);
             });
             headers.put(sortMeta, headerLabel.get());
diff --git a/primefaces/src/main/java/org/primefaces/component/treetable/TreeTableRenderer.java b/primefaces/src/main/java/org/primefaces/component/treetable/TreeTableRenderer.java
index 568ea1bf2c..60d7884c80 100644
--- a/primefaces/src/main/java/org/primefaces/component/treetable/TreeTableRenderer.java
+++ b/primefaces/src/main/java/org/primefaces/component/treetable/TreeTableRenderer.java
@@ -627,15 +627,14 @@ public class TreeTableRenderer extends DataRenderer {
         ColumnMeta columnMeta = tt.getColumnMeta().get(column.getColumnKey());
 
         ResponseWriter writer = context.getResponseWriter();
-        UIComponent header = column.getFacet("header");
-        String headerText = column.getHeaderText();
+        UIComponent headerFacet = column.getFacet("header");
+        String headerText = resolveColumnHeaderText(context, column);
+        String ariaHeaderText = resolveColumnAriaHeaderText(context, column);
         String title = column.getTitle();
-        String ariaHeaderText = column.getAriaHeaderText();
-        headerText = LangUtils.isNotBlank(headerText) ? headerText : ariaHeaderText;
 
         String titlestyleClass = getStyleClassBuilder(context)
                 .add("ui-column-title")
-                .add(LangUtils.isNotBlank(ariaHeaderText), "ui-helper-hidden-accessible")
+                .add(isColumnAriaHeaderTextDefined(context, column), "ui-helper-hidden-accessible")
                 .build();
 
         boolean columnVisible = column.isVisible();
@@ -684,12 +683,10 @@ public class TreeTableRenderer extends DataRenderer {
             }
         }
 
-        String ariaHeaderLabel = getHeaderLabel(context, column);
-
         writer.startElement("th", null);
         writer.writeAttribute("id", column.getContainerClientId(context), null);
         writer.writeAttribute("class", columnClass, null);
-        writer.writeAttribute(HTML.ARIA_LABEL, ariaHeaderLabel, null);
+        writer.writeAttribute(HTML.ARIA_LABEL, ariaHeaderText, null);
         if (style != null) {
             writer.writeAttribute("style", style, null);
         }
@@ -703,8 +700,8 @@ public class TreeTableRenderer extends DataRenderer {
         writer.startElement("span", null);
         writer.writeAttribute("class", titlestyleClass, null);
 
-        if (FacetUtils.shouldRenderFacet(header)) {
-            header.encodeAll(context);
+        if (FacetUtils.shouldRenderFacet(headerFacet)) {
+            headerFacet.encodeAll(context);
         }
         else if (headerText != null) {
             writer.writeText(headerText, "headerText");
diff --git a/primefaces/src/main/java/org/primefaces/model/filter/EqualsFilterConstraint.java b/primefaces/src/main/java/org/primefaces/model/filter/EqualsFilterConstraint.java
index 22062719cd..6c122b8012 100644
--- a/primefaces/src/main/java/org/primefaces/model/filter/EqualsFilterConstraint.java
+++ b/primefaces/src/main/java/org/primefaces/model/filter/EqualsFilterConstraint.java
@@ -39,6 +39,10 @@ public class EqualsFilterConstraint implements FilterConstraint {
         if (value == null || filter == null) {
             return false;
         }
+        // Handle enum values by comparing their string representations
+        if (value.getClass().isEnum() || filter.getClass().isEnum()) {
+            return value.toString().equals(filter.toString());
+        }
         // If Comparable, prefer compareTo to handle BigDecimal, etc.
         if (value instanceof Comparable) {
             ComparableFilterConstraint.assertAssignable(filter, value);
diff --git a/primefaces/src/main/java/org/primefaces/renderkit/DataRenderer.java b/primefaces/src/main/java/org/primefaces/renderkit/DataRenderer.java
index 665ae4ef94..c4fe187c08 100644
--- a/primefaces/src/main/java/org/primefaces/renderkit/DataRenderer.java
+++ b/primefaces/src/main/java/org/primefaces/renderkit/DataRenderer.java
@@ -38,7 +38,9 @@ import org.primefaces.component.paginator.PaginatorElementRenderer;
 import org.primefaces.component.paginator.PrevPageLinkRenderer;
 import org.primefaces.component.paginator.RowsPerPageDropdownRenderer;
 import org.primefaces.util.ComponentUtils;
+import org.primefaces.util.Constants;
 import org.primefaces.util.FacetUtils;
+import org.primefaces.util.LangUtils;
 import org.primefaces.util.MapBuilder;
 import org.primefaces.util.WidgetBuilder;
 
@@ -46,7 +48,6 @@ import java.io.IOException;
 import java.util.Map;
 
 import javax.faces.component.UIComponent;
-import javax.faces.component.UIPanel;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
@@ -197,38 +198,64 @@ public class DataRenderer extends CoreRenderer {
         }
     }
 
+    protected boolean isColumnAriaHeaderTextDefined(FacesContext context, UIColumn column) {
+        return LangUtils.isNotBlank(column.getAriaHeaderText());
+    }
 
-    protected String getHeaderLabel(FacesContext context, UIColumn column) {
-        String ariaHeaderText = column.getAriaHeaderText();
-
-        // for headerText of column
-        if (ariaHeaderText == null) {
-            ariaHeaderText = column.getHeaderText();
+    protected String resolveColumnAriaHeaderText(FacesContext context, UIColumn column) {
+        if (column instanceof UIComponent) {
+            UIComponent component = (UIComponent) column;
+            component.pushComponentToEL(context, component);
         }
 
-        // for header facet
-        if (ariaHeaderText == null) {
-            UIComponent header = column.getFacet("header");
-            if (FacetUtils.shouldRenderFacet(header)) {
-                if (header instanceof UIPanel) {
-                    for (UIComponent child : header.getChildren()) {
-                        if (child.isRendered()) {
-                            String value = ComponentUtils.getValueToRender(context, child);
+        try {
+            String ariaHeaderText = column.getAriaHeaderText();
 
-                            if (value != null) {
-                                ariaHeaderText = value;
-                                break;
-                            }
-                        }
-                    }
-                }
-                else {
-                    ariaHeaderText = ComponentUtils.getValueToRender(context, header);
+            // for headerText of column
+            if (ariaHeaderText == null) {
+                ariaHeaderText = column.getHeaderText();
+            }
+
+            // for header facet
+            if (ariaHeaderText == null) {
+                UIComponent headerFacet = column.getFacet("header");
+                if (FacetUtils.shouldRenderFacet(headerFacet)) {
+                    // encode and strip all HTML tags
+                    ariaHeaderText = ComponentUtils.encodeComponent(headerFacet, context).replaceAll("\\<.*?\\>", Constants.EMPTY_STRING);
                 }
             }
-        }
 
-        return ariaHeaderText;
+            return ariaHeaderText;
+        }
+        finally {
+            if (column instanceof UIComponent) {
+                UIComponent component = (UIComponent) column;
+                component.popComponentFromEL(context);
+            }
+        }
     }
 
+    protected String resolveColumnHeaderText(FacesContext context, UIColumn column) {
+        if (column instanceof UIComponent) {
+            UIComponent component = (UIComponent) column;
+            component.pushComponentToEL(context, component);
+        }
+
+        try {
+            String headerText = column.getHeaderText();
+
+            // for ariaHeaderText of column
+            if (headerText == null) {
+                headerText = column.getAriaHeaderText();
+            }
+
+            return headerText;
+        }
+        finally {
+            if (column instanceof UIComponent) {
+                UIComponent component = (UIComponent) column;
+                component.popComponentFromEL(context);
+            }
+        }
+    }
 }


Test patch:
diff --git a/primefaces/src/test/java/org/primefaces/model/filter/EqualsFilterConstraintTest.java b/primefaces/src/test/java/org/primefaces/model/filter/EqualsFilterConstraintTest.java
new file mode 100644
index 0000000000..8c0bcf2925
--- /dev/null
+++ b/primefaces/src/test/java/org/primefaces/model/filter/EqualsFilterConstraintTest.java
@@ -0,0 +1,134 @@
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2009-2024 PrimeTek Informatics
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package org.primefaces.model.filter;
+
+import java.math.BigDecimal;
+import java.util.Objects;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class EqualsFilterConstraintTest {
+    private EqualsFilterConstraint constraint;
+
+    @BeforeEach
+    void setup() {
+        constraint = new EqualsFilterConstraint();
+    }
+
+    @Test
+    void testCompareToEquals_Equal() {
+        assertTrue(constraint.compareToEquals(BigDecimal.ONE, BigDecimal.ONE));
+    }
+
+    @Test
+    void testCompareToEquals_NotEqual() {
+        assertFalse(constraint.compareToEquals(BigDecimal.ONE, BigDecimal.TEN));
+    }
+
+    @Test
+    void testCompareToEquals_BigDecimalPlaces() {
+        assertTrue(constraint.compareToEquals(new BigDecimal("1.0"), new BigDecimal("1.0000")));
+    }
+
+    @Test
+    void testIsMatching_SameReference() {
+        Object value = "test";
+        assertTrue(constraint.isMatching(null, value, value, null));
+    }
+
+    @Test
+    void testIsMatching_NullValue() {
+        assertFalse(constraint.isMatching(null, null, "test", null));
+    }
+
+    @Test
+    void testIsMatching_NullFilter() {
+        assertFalse(constraint.isMatching(null, "test", null, null));
+    }
+
+    @Test
+    void testIsMatching_EnumValues() {
+        assertTrue(constraint.isMatching(null, TestEnum.A, TestEnum.A, null));
+        assertFalse(constraint.isMatching(null, TestEnum.A, TestEnum.B, null));
+    }
+
+    @Test
+    void testIsMatching_EnumValuesAsString() {
+        assertTrue(constraint.isMatching(null, TestEnum.A, "A", null));
+        assertFalse(constraint.isMatching(null, TestEnum.A, "B", null));
+    }
+
+    @Test
+    void testIsMatching_ComparableNumbers() {
+        assertTrue(constraint.isMatching(null, BigDecimal.ONE, BigDecimal.ONE, null));
+        assertFalse(constraint.isMatching(null, BigDecimal.ONE, BigDecimal.TEN, null));
+    }
+
+    @Test
+    void testIsMatching_NonComparableObjects() {
+        Object obj1 = new TestObject("test");
+        Object obj2 = new TestObject("test");
+        Object obj3 = new TestObject("different");
+
+        assertTrue(constraint.isMatching(null, obj1, obj2, null));
+        assertFalse(constraint.isMatching(null, obj1, obj3, null));
+    }
+
+    @Test
+    void testIsMatching_InvalidComparison() {
+        assertThrows(IllegalArgumentException.class, () -> {
+            constraint.isMatching(null, BigDecimal.ONE, "1", null);
+        });
+    }
+
+    private enum TestEnum {
+        A, B
+    }
+
+    private static class TestObject {
+        private final String value;
+
+        TestObject(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+            TestObject that = (TestObject) o;
+            return Objects.equals(value, that.value);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(value);
+        }
+    }
+}