You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/10/18 17:03:37 UTC

svn commit: r1399689 - /jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestLiteralLabels.java

Author: andy
Date: Thu Oct 18 15:03:36 2012
New Revision: 1399689

URL: http://svn.apache.org/viewvc?rev=1399689&view=rev
Log:
Tests to cover JENA-335

Modified:
    jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestLiteralLabels.java

Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestLiteralLabels.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestLiteralLabels.java?rev=1399689&r1=1399688&r2=1399689&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestLiteralLabels.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestLiteralLabels.java Thu Oct 18 15:03:36 2012
@@ -24,63 +24,74 @@ import com.hp.hpl.jena.graph.impl.Litera
 
 import junit.framework.*;
 
-/**
-    Tests submitted By: Wolfgang Groiss (littlelui) via SF bugtracker, incorporated
-    into new test class by kers.
-    
-    @author kers
-*/
 public class TestLiteralLabels extends GraphTestBase
+{
+    public TestLiteralLabels(String name)
     {
-    public TestLiteralLabels( String name )
-        { super( name );  }
+        super(name) ;
+    }
 
     public static Test suite()
-        { return new TestSuite( TestLiteralLabels.class ); }
-    
-    public void testHashCode()  
-        {
-        LiteralLabel ll = LiteralLabelFactory.create( "test", "", null );
-        ll.hashCode();
-        }
-
-    public void testHashCode2() 
-        {
-        LiteralLabel ll = LiteralLabelFactory.create( "test",  "", null );
-        ll.hashCode();
-        }    
-    
-    public void testHashCodesForBase64Binary()
-        {
-        LiteralLabel A = node( "'0123'http://www.w3.org/2001/XMLSchema#base64Binary" ).getLiteral();
-        LiteralLabel B = node( "'0123'http://www.w3.org/2001/XMLSchema#base64Binary" ).getLiteral();
-        assertEquals( A.hashCode(), B.hashCode() );
-        }
-    
-    public void testHashCodesForHexBinary()
-        {
-        LiteralLabel A = node( "'0123'http://www.w3.org/2001/XMLSchema#hexBinary" ).getLiteral();
-        LiteralLabel B = node( "'0123'http://www.w3.org/2001/XMLSchema#hexBinary" ).getLiteral();
-        assertEquals( A.hashCode(), B.hashCode() );
-        }
-    
+    {
+        return new TestSuite(TestLiteralLabels.class) ;
+    }
+
+    public void testHashCode()
+    {
+        LiteralLabel ll = LiteralLabelFactory.create("test", "", null) ;
+        ll.hashCode() ;
+    }
+
+    public void testHashCode2()
+    {
+        LiteralLabel ll1 = LiteralLabelFactory.create("test", "", null) ;
+        LiteralLabel ll2 = LiteralLabelFactory.create("test", "", null) ;
+        assertEquals(ll1.hashCode(), ll2.hashCode()) ;
+    }
+
+    public void testHashCodesForBase64Binary_1()
+    {
+        LiteralLabel A = node("'0123'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() ;
+        LiteralLabel B = node("'0123'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() ;
+        assertEquals(A.hashCode(), B.hashCode()) ;
+    }
+
+    public void testHashCodesForBase64Binary_2()
+    {
+        LiteralLabel A = node("'illgeal'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() ;
+        LiteralLabel B = node("'illgeal'http://www.w3.org/2001/XMLSchema#base64Binary").getLiteral() ;
+        assertEquals(A.hashCode(), B.hashCode()) ;
+    }
+
+    public void testHashCodesForHexBinary_1()
+    {
+        LiteralLabel A = node("'0123'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ;
+        LiteralLabel B = node("'0123'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ;
+        assertEquals(A.hashCode(), B.hashCode()) ;
+    }
+
+    public void testHashCodesForHexBinary_2()
+    {
+        LiteralLabel A = node("'illegal'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ;
+        LiteralLabel B = node("'illegal'http://www.w3.org/2001/XMLSchema#hexBinary").getLiteral() ;
+        assertEquals(A.hashCode(), B.hashCode()) ;
+    }
+
     public void testDatatypeIsEqualsNotCalledIfSecondOperandIsNotTyped()
-        {
-        RDFDatatype d = new BaseDatatype( "eh:/FakeDataType" ) 
-            {
+    {
+        RDFDatatype d = new BaseDatatype("eh:/FakeDataType") {
             @Override
-            public boolean isEqual( LiteralLabel A, LiteralLabel B ) 
-                { 
-                fail( "RDFDatatype::isEquals should not be called if B has no datatype" ); 
-                return false; 
-                }
-            };
-        LiteralLabel A = LiteralLabelFactory.create( "17", "", d );
-        LiteralLabel B = LiteralLabelFactory.create( "17", "", null );
-        assertFalse( A.sameValueAs( B ) );
-        }
+            public boolean isEqual(LiteralLabel A, LiteralLabel B)
+            {
+                fail("RDFDatatype::isEquals should not be called if B has no datatype") ;
+                return false ;
+            }
+        } ;
+        LiteralLabel A = LiteralLabelFactory.create("17", "", d) ;
+        LiteralLabel B = LiteralLabelFactory.create("17", "", null) ;
+        assertFalse(A.sameValueAs(B)) ;
+    }
 
-    // AFS
     public void testEquality1()
     {
         LiteralLabel A = LiteralLabelFactory.create("xyz") ;