Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1413

PropertiesTest#g_V_hasXageX_propertiesXnameX assumes that ids are longs

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Done
    • 3.1.3
    • 3.1.4, 3.2.2
    • test-suite
    • None

    Description

      This assert assumes that Ids are longs.

      assertEquals(Long.valueOf(convertToVertex(graph, vertexProperty.value()).properties("name").next().id().toString()), Long.valueOf(vertexProperty.id().toString()));
      

      Attachments

        Activity

          Okay. I pushed a fix.

          Object id = vertexProperty.id();
          id = id instanceof Number ? ((Number) id).longValue() : id;
          Object otherId = convertToVertex(graph, vertexProperty.value()).property("name").id();
          otherId = otherId instanceof Number ? ((Number) otherId).longValue() : otherId;
          assertEquals(otherId, id);
          

          This should handle both situations.

          okram Marko A. Rodriguez added a comment - Okay. I pushed a fix. Object id = vertexProperty.id(); id = id instanceof Number ? (( Number ) id).longValue() : id; Object otherId = convertToVertex(graph, vertexProperty.value()).property( "name" ).id(); otherId = otherId instanceof Number ? (( Number ) otherId).longValue() : otherId; assertEquals(otherId, id); This should handle both situations.

          Ah.... dar. Hm. I'll do this. If its a Number, I'll coerce to Long.

          okram Marko A. Rodriguez added a comment - Ah.... dar. Hm. I'll do this. If its a Number, I'll coerce to Long.
          pluradj Jason Plurad added a comment - background info https://issues.apache.org/jira/browse/TINKERPOP-1360

          This is simply a poorly written test case. Will fix now.

          okram Marko A. Rodriguez added a comment - This is simply a poorly written test case. Will fix now.
          bryncooke Bryn Cooke added a comment -

          I don't understand why the IDs need to be compared as longs. Why are the IDs not compared using equals?

          bryncooke Bryn Cooke added a comment - I don't understand why the IDs need to be compared as longs. Why are the IDs not compared using equals?

          People

            okram Marko A. Rodriguez
            bryncooke Bryn Cooke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: