jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/6] jena git commit: Some tests for Node_Ext
Date Tue, 12 Dec 2017 10:05:38 GMT
Some tests for Node_Ext


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/63e86635
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/63e86635
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/63e86635

Branch: refs/heads/master
Commit: 63e86635a2d35f1e2eb1e6058607c173038df81f
Parents: 41d2f73
Author: Andy Seaborne <andy@apache.org>
Authored: Sun Dec 10 13:34:03 2017 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Sun Dec 10 13:39:28 2017 +0000

----------------------------------------------------------------------
 .../org/apache/jena/graph/test/TestNodeExt.java | 69 ++++++++++++++++++++
 .../org/apache/jena/graph/test/TestPackage.java |  5 +-
 2 files changed, 72 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/63e86635/jena-core/src/test/java/org/apache/jena/graph/test/TestNodeExt.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/graph/test/TestNodeExt.java b/jena-core/src/test/java/org/apache/jena/graph/test/TestNodeExt.java
new file mode 100644
index 0000000..a921976
--- /dev/null
+++ b/jena-core/src/test/java/org/apache/jena/graph/test/TestNodeExt.java
@@ -0,0 +1,69 @@
+/*
+ * 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.jena.graph.test;
+
+import static org.junit.Assert.*;
+
+import org.apache.jena.graph.*;
+import org.junit.Test;
+
+/** Tests for {@link Node_Ext} */
+public class TestNodeExt {
+
+    private Node s = NodeFactory.createBlankNode();
+    private Node p = NodeCreateUtils.create("eg:p");
+    private Node o = NodeCreateUtils.create("'abc'");
+    
+    private Triple triple1 = Triple.create(s,p,o);
+    private Triple triple2 = Triple.create(s,p,o);
+
+    private Triple triple9 = Triple.create(NodeFactory.createBlankNode(),p,o);
+    
+    @Test public void ext_triple_1() {
+        Node_Triple nt = new Node_Triple(triple1);
+        assertNotNull(nt.get());
+        assertSame(triple1, nt.get());
+    }
+    
+    @Test public void ext_triple_2() {
+        Node_Triple nt1 = new Node_Triple(triple1);
+        Node_Triple nt2 = new Node_Triple(triple1);
+        assertSame(nt1.get(), nt2.get());
+        assertNotSame(nt1, nt2);
+        assertEquals(nt1, nt2);
+        assertEquals(nt1.hashCode(), nt2.hashCode());
+    }
+
+    @Test public void ext_triple_3() {
+        Node_Triple nt1 = new Node_Triple(triple1);
+        Node_Triple nt2 = new Node_Triple(triple2);
+        assertNotSame(nt1.get(), nt2.get());
+        assertNotSame(nt1, nt2);
+        assertEquals(nt1, nt2);
+        assertEquals(nt1.hashCode(), nt2.hashCode());
+    }
+
+    @Test public void ext_triple_4() {
+        Node_Triple nt1 = new Node_Triple(triple1);
+        Node_Triple nt9 = new Node_Triple(triple9);
+        assertNotSame(nt1.get(), nt9.get());
+        assertNotSame(nt1, nt9);
+        assertNotEquals(nt1, nt9);
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/63e86635/jena-core/src/test/java/org/apache/jena/graph/test/TestPackage.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/graph/test/TestPackage.java b/jena-core/src/test/java/org/apache/jena/graph/test/TestPackage.java
index 99cf925..3990502 100644
--- a/jena-core/src/test/java/org/apache/jena/graph/test/TestPackage.java
+++ b/jena-core/src/test/java/org/apache/jena/graph/test/TestPackage.java
@@ -47,7 +47,7 @@ public class TestPackage extends TestSuite {
         addTest( TestDateTime.suite() );
         addTest( TestFactory.suite() );
         addTest( TestGraph.suite() );
-        addTest( new JUnit4TestAdapter(TestGraphPlain.class ) );
+        addTest( new JUnit4TestAdapter(TestGraphPlain.class) );
         addTest( TestSimpleGraphMaker.suite() );
         addTest( TestGraphExtract.suite() );
         addTest( TestCapabilities.suite() );
@@ -56,8 +56,9 @@ public class TestPackage extends TestSuite {
         addTest( TestGraphMatchWithInference.suite());
         addTestSuite( TestGraphEvents.class );
         addTestSuite( TestGraphBaseToString.class );
+        addTest( new JUnit4TestAdapter(TestNodeExt.class) );
         
         // Has to be in a different package.
-        addTest( new JUnit4TestAdapter(TestGraphUtil.class ) );
+        addTest( new JUnit4TestAdapter(TestGraphUtil.class) );
     }
 }


Mime
View raw message