You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/05/21 22:49:41 UTC
[1/2] incubator-tinkerpop git commit: Add tests for T.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 6153c5fe6 -> aa2ddf497
Add tests for T.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/aa2ddf49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/aa2ddf49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/aa2ddf49
Branch: refs/heads/master
Commit: aa2ddf49776d4ca73d578c697dbcd902c6d51bbd
Parents: 02fae63
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 21 16:49:06 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu May 21 16:49:32 2015 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/structure/TTest.java | 87 ++++++++++++++++++++
1 file changed, 87 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/aa2ddf49/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/TTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/TTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/TTest.java
new file mode 100644
index 0000000..78a6b63
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/TTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.structure;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class TTest {
+ @Test
+ public void shouldGetLabelEnumFromString() {
+ assertEquals(T.label, T.fromString(T.label.getAccessor()));
+ }
+
+ @Test
+ public void shouldGetIdEnumFromString() {
+ assertEquals(T.id, T.fromString(T.id.getAccessor()));
+ }
+
+ @Test
+ public void shouldGetKeyEnumFromString() {
+ assertEquals(T.key, T.fromString(T.key.getAccessor()));
+ }
+
+ @Test
+ public void shouldGetValueEnumFromString() {
+ assertEquals(T.value, T.fromString(T.value.getAccessor()));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void shouldThrowIfAccesorIsNotExpected() {
+ T.fromString("blah");
+ }
+
+ @Test
+ public void shouldApplyLabelOnElement() {
+ final Element e = mock(Element.class);
+ when(e.label()).thenReturn("knows");
+
+ assertEquals("knows", T.label.apply(e));
+ }
+
+ @Test
+ public void shouldApplyIdOnElement() {
+ final Element e = mock(Element.class);
+ when(e.id()).thenReturn(100l);
+
+ assertEquals(100l, T.id.apply(e));
+ }
+
+ @Test
+ public void shouldApplyKeyOnVertexProperty() {
+ final VertexProperty e = mock(VertexProperty.class);
+ when(e.key()).thenReturn("keyName");
+
+ assertEquals("keyName", T.key.apply(e));
+ }
+
+ @Test
+ public void shouldApplyValueOnVertexProperty() {
+ final VertexProperty e = mock(VertexProperty.class);
+ when(e.value()).thenReturn("val");
+
+ assertEquals("val", T.value.apply(e));
+ }
+}
[2/2] incubator-tinkerpop git commit: Add tests for the Direction
enum.
Posted by sp...@apache.org.
Add tests for the Direction enum.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/02fae63a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/02fae63a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/02fae63a
Branch: refs/heads/master
Commit: 02fae63af66f9593eb3ca02db804e2a11d0ee0a5
Parents: 6153c5f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 21 16:36:01 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu May 21 16:49:32 2015 -0400
----------------------------------------------------------------------
.../gremlin/structure/DirectionTest.java | 25 ++++++++++++++++++++
1 file changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/02fae63a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/DirectionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/DirectionTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/DirectionTest.java
new file mode 100644
index 0000000..61ddd53
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/DirectionTest.java
@@ -0,0 +1,25 @@
+package org.apache.tinkerpop.gremlin.structure;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class DirectionTest {
+ @Test
+ public void shouldReturnOppositeOfIn() {
+ assertEquals(Direction.OUT, Direction.IN.opposite());
+ }
+
+ @Test
+ public void shouldReturnOppositeOfOut() {
+ assertEquals(Direction.IN, Direction.OUT.opposite());
+ }
+
+ @Test
+ public void shouldReturnOppositeOfBoth() {
+ assertEquals(Direction.BOTH, Direction.BOTH.opposite());
+ }
+}