commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [03/50] [abbrv] commons-rdf git commit: wider test coverage of Quad.asTriple()
Date Thu, 12 Jan 2017 17:35:51 GMT
wider test coverage of Quad.asTriple()


Project: http://git-wip-us.apache.org/repos/asf/commons-rdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rdf/commit/fb165fa1
Tree: http://git-wip-us.apache.org/repos/asf/commons-rdf/tree/fb165fa1
Diff: http://git-wip-us.apache.org/repos/asf/commons-rdf/diff/fb165fa1

Branch: refs/heads/COMMONSRDF-47
Commit: fb165fa163ae7b3530bcc598be4b0526c88fa67c
Parents: cb6f2c1
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Fri Nov 4 10:57:28 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Fri Nov 4 10:57:28 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/commons/rdf/api/DefaultQuadTest.java | 11 +++++++++++
 .../java/org/apache/commons/rdf/api/RDFSyntaxTest.java   |  6 ++++++
 2 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/fb165fa1/api/src/test/java/org/apache/commons/rdf/api/DefaultQuadTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/commons/rdf/api/DefaultQuadTest.java b/api/src/test/java/org/apache/commons/rdf/api/DefaultQuadTest.java
index 9d563cd..53ba26d 100644
--- a/api/src/test/java/org/apache/commons/rdf/api/DefaultQuadTest.java
+++ b/api/src/test/java/org/apache/commons/rdf/api/DefaultQuadTest.java
@@ -19,6 +19,8 @@ package org.apache.commons.rdf.api;
 
 import static org.junit.Assert.*;
 
+import java.util.Objects;
+
 import org.junit.Test;
 
 public class DefaultQuadTest {
@@ -26,11 +28,20 @@ public class DefaultQuadTest {
     public void asQuad() throws Exception {
         Quad q = new DummyQuad();
         Triple t = q.asTriple();
+        assertEquals(t, t);
+        assertNotEquals(t,  q);
+        assertEquals(t, new DummyTriple());
+        assertEquals(t, new DummyQuad().asTriple());
+        
         // FIXME: This would not catch if asTriple() accidentally mixed up s/p/o
         // as they are here all the same
         assertEquals(new DummyIRI(1), t.getSubject());
         assertEquals(new DummyIRI(2), t.getPredicate());
         assertEquals(new DummyIRI(3), t.getObject());
+        
+        
+        
+        assertEquals(Objects.hash(q.getSubject(), q.getPredicate(), q.getObject()), t.hashCode());
     }
     
 }

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/fb165fa1/api/src/test/java/org/apache/commons/rdf/api/RDFSyntaxTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/commons/rdf/api/RDFSyntaxTest.java b/api/src/test/java/org/apache/commons/rdf/api/RDFSyntaxTest.java
index a1cb62e..3e22da6 100644
--- a/api/src/test/java/org/apache/commons/rdf/api/RDFSyntaxTest.java
+++ b/api/src/test/java/org/apache/commons/rdf/api/RDFSyntaxTest.java
@@ -112,4 +112,10 @@ public class RDFSyntaxTest {
         assertEquals("RDF 1.1 Turtle", RDFSyntax.TURTLE.toString());
     }
 
+    @Test
+    public void valueOf() throws Exception {
+        assertEquals(RDFSyntax.TURTLE, RDFSyntax.valueOf("TURTLE"));
+        // No need to test all of them, we'll trust Enum
+    }
+    
 }


Mime
View raw message