afs commented on code in PR #2810:
URL: https://github.com/apache/jena/pull/2810#discussion_r1822193742


##########
jena-core/src/test/java/org/apache/jena/datatypes/TestDatatypes.java:
##########
@@ -197,6 +199,71 @@ public class TestDatatypes {
         testLiteralIsCorrectType("5.55", XSDDatatype.XSDfloat) ;
     }
 
+    @Test public void baseDataTypeEquality() {
+        var rdfDataType1 = new BaseDatatype("urn:x-hp-dt:unknown");
+        assertEquals(rdfDataType1, rdfDataType1);
+
+        var rdfDataType2 = new BaseDatatype("urn:x-hp-dt:unknown");
+        assertEquals(rdfDataType1, rdfDataType2);
+        assertEquals(rdfDataType2, rdfDataType1);
+
+        assertEquals(rdfDataType1.hashCode(), rdfDataType2.hashCode());
+    }
+
+    @Test public void baseDataTypeEmptyEquality() {
+        var rdfDataType1 = new BaseDatatype("");
+        assertEquals(rdfDataType1, rdfDataType1);
+
+        var rdfDataType2 = new BaseDatatype("");
+        assertEquals(rdfDataType1, rdfDataType2);
+        assertEquals(rdfDataType2, rdfDataType1);
+
+        assertEquals(rdfDataType1.hashCode(), rdfDataType2.hashCode());
+    }
+
+    @Test public void baseDataTypeNullEquality() {
+        var rdfDataType1 = new BaseDatatype(null);
+        assertEquals(rdfDataType1, rdfDataType1);
+
+        var rdfDataType2 = new BaseDatatype(null);
+        assertEquals(rdfDataType1, rdfDataType2);
+        assertEquals(rdfDataType2, rdfDataType1);
+
+        assertEquals(rdfDataType1.hashCode(), rdfDataType2.hashCode());
+    }
+
+    @Test public void xsdDoubleEquality() {
+        var rdfDataType1 = new XSDDouble("double", Double.class);
+        assertEquals(rdfDataType1, rdfDataType1);
+
+        var rdfDataType2 = XSDDatatype.XSDdouble;
+        assertEquals(rdfDataType1, rdfDataType2);
+        assertEquals(rdfDataType2, rdfDataType1);
+
+        assertEquals(rdfDataType1.hashCode(), rdfDataType2.hashCode());
+    }
+
+    @Test public void baseDataTypeNotEquals() {
+        var rdfDataType1 = new BaseDatatype("urn:x-hp-dt:unknownA");
+        var rdfDataType2 = new BaseDatatype("urn:x-hp-dt:unknownB");

Review Comment:
   FYI:
   
   When this is merged, I'd update those as part of the IR3986 PR because 
"urn:x-" is now (RFC 8141) discouraged. I replaced usage with "urn:jena-dt:" 
where it is not visible to the application.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscr...@jena.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@jena.apache.org
For additional commands, e-mail: pr-h...@jena.apache.org

Reply via email to