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

xiazcy pushed a commit to branch 3.8-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/3.8-dev by this push:
     new e8f41c81b9 CTR fix GraphTraversalTests with hasId() unrolling behavior
e8f41c81b9 is described below

commit e8f41c81b94a8c5fa52dc8c41065e103675b8d3b
Author: Yang Xia <[email protected]>
AuthorDate: Wed Jul 22 16:13:23 2026 -0700

    CTR fix GraphTraversalTests with hasId() unrolling behavior
---
 .../traversal/dsl/graph/GraphTraversalTest.java      | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
index 0436ab09e8..fbcfc1133e 100644
--- 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
@@ -46,6 +46,7 @@ import java.util.function.Consumer;
 import static 
org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource.traversal;
 import static 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.aggregate;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -252,8 +253,23 @@ public class GraphTraversalTest {
         return temp.substring(temp.length() - (random.nextInt(2) + 1)) + 
s.replace("\"", "x").replace(",", "y").replace("'", "z");
     }
 
+    @Test
     public void hasIdShouldUnrollListOfIds() {
-        assertEquals(g.V().hasId(1,2,3,4,5,6,7,8),
-                g.V().hasId(new Integer[]{1, 2, 3}, new Integer[]{4, 5}, 
Arrays.asList(6, 7), 8));
+        // a single array or Collection argument is unrolled into individual 
ids (TINKERPOP-2863)
+        assertEquals(g.V().hasId(1, 2, 3), g.V().hasId(new Integer[]{1, 2, 
3}));
+        assertEquals(g.V().hasId(1, 2, 3), g.V().hasId(Arrays.asList(1, 2, 
3)));
+        // multiple arguments are treated as literal ids and are not unrolled 
(TINKERPOP-3273)
+        assertNotEquals(g.V().hasId(1, 2, 3), g.V().hasId(new Integer[]{1, 2}, 
3));
+    }
+
+    @Test
+    public void hasIdShouldUnrollGValueListOfIds() {
+        // a single GValue wrapping an array or Collection is unrolled; the 
array and Collection forms
+        // of the same ids produce the same result (TINKERPOP-2863)
+        assertEquals(g.V().hasId(GValue.of("a", Arrays.asList(1, 2, 3))),
+                g.V().hasId(GValue.of("a", new Integer[]{1, 2, 3})));
+        // multiple arguments are treated as literal ids and are not unrolled 
(TINKERPOP-3273)
+        assertNotEquals(g.V().hasId(GValue.of("a", new Integer[]{1, 2}), 
GValue.of("b", 3)),
+                g.V().hasId(GValue.of("a", new Integer[]{1, 2, 3})));
     }
 }

Reply via email to