You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "pieter martin (JIRA)" <ji...@apache.org> on 2016/04/10 21:12:25 UTC

[jira] [Created] (TINKERPOP-1259) SerializationTest.shouldSerializeTree fails due to id() and hashCode()

pieter martin created TINKERPOP-1259:
----------------------------------------

             Summary: SerializationTest.shouldSerializeTree fails due to id() and hashCode()
                 Key: TINKERPOP-1259
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1259
             Project: TinkerPop
          Issue Type: Bug
          Components: test-suite
    Affects Versions: 3.2.1
            Reporter: pieter martin


The tests fails on the last 

{code}
assertEquals("The objects differ", after, before)
{code}

The 2 trees are however correct but due to differences in the {{DetachedVertexProperty}} and {{SqlgVertexProperty}} {{id()}}, {{equals()}} and {{hashCode()}} implementation the 2 trees are not equal.

{{DetachedVertexProperty}} uses the {{element}}'s {{id}} as its {{id}} and that is used in the {{equals}} and {{hashCode}} method basically making a property equal to an element.

{{SqlgVertexProperty}} has a more sophisticated {{id()}}

{code}
return (long) (this.key().hashCode() + this.value().hashCode() + this.element().id().hashCode())
{code}

If I change this to be the same as {{DetachedVertexProperty}} then the test passes but I am not sure that it would be correct.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)