Skip to content

Commit

Permalink
Merge pull request #18 from FalkorDB/point-test
Browse files Browse the repository at this point in the history
test result
  • Loading branch information
gkorland authored Dec 13, 2023
2 parents df03a80 + 3168155 commit 028e559
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/falkordb/graph_entities/GraphEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ public void removeProperty(String name) {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof GraphEntity)) return false;
if (this == o){
return true;
}
if (!(o instanceof GraphEntity)){
return false;
}
GraphEntity that = (GraphEntity) o;
return id == that.id &&
Objects.equals(propertyMap, that.propertyMap);
Expand Down
18 changes: 12 additions & 6 deletions src/test/java/com/falkordb/GraphAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ public void testRecord() {
Property<Boolean> trueBooleanProperty = new Property<>("boolValue", true);
Property<Boolean> falseBooleanProperty = new Property<>("boolValue", false);

Property<String> placeProperty = new Property<>("place", place);
Property<Integer> sinceProperty = new Property<>("since", since);

Node expectedNode = new Node();
expectedNode.setId(0);
expectedNode.addLabel("person");
Expand All @@ -227,21 +224,23 @@ public void testRecord() {
+ "doubleValue=Property{name='doubleValue', value=3.14}, "
+ "age=Property{name='age', value=32}}}",
expectedNode.toString());
Assert.assertEquals( 4, expectedNode.getNumberOfProperties());

Edge expectedEdge = new Edge();
expectedEdge.setId(0);
expectedEdge.setSource(0);
expectedEdge.setDestination(1);
expectedEdge.setRelationshipType("knows");
expectedEdge.addProperty(placeProperty);
expectedEdge.addProperty(sinceProperty);
expectedEdge.addProperty("place", place);
expectedEdge.addProperty("since", since);
expectedEdge.addProperty(doubleProperty);
expectedEdge.addProperty(falseBooleanProperty);
Assert.assertEquals("Edge{relationshipType='knows', source=0, destination=1, id=0, "
+ "propertyMap={boolValue=Property{name='boolValue', value=false}, "
+ "place=Property{name='place', value=TLV}, "
+ "doubleValue=Property{name='doubleValue', value=3.14}, "
+ "since=Property{name='since', value=2000}}}", expectedEdge.toString());
Assert.assertEquals( 4, expectedEdge.getNumberOfProperties());

Map<String, Object> params = new HashMap<>();
params.put("name", name);
Expand Down Expand Up @@ -876,7 +875,14 @@ private void assertTestGeoPoint() {
Assert.assertEquals(Collections.singletonList("restaurant"), record.keys());
Node node = record.getValue(0);
Property<?> property = node.getProperty("location");
Assert.assertEquals(new Point(30.27822306, -97.75134723), property.getValue());
Point result = (Point)property.getValue();

Point point = new Point(30.27822306, -97.75134723);
Assert.assertEquals(point, result);
Assert.assertEquals(30.27822306, result.getLatitude(), 0.01);
Assert.assertEquals(-97.75134723, result.getLongitude(), 0.01);
Assert.assertEquals("Point{latitude=30.2782230377197, longitude=-97.751350402832}", result.toString());
Assert.assertEquals(-132320535, result.hashCode());
}

@Test
Expand Down

0 comments on commit 028e559

Please sign in to comment.