Skip to content

Commit d0a3100

Browse files
Enhance Steiner tree write test
Co-authored-by: Ioannis Panagiotas <ioannis.panagiotas@neotechnology.com>
1 parent aeabbba commit d0a3100

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

proc/path-finding/src/test/java/org/neo4j/gds/paths/steiner/SteinerTreeWriteProcTest.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
import org.neo4j.gds.extension.Neo4jGraph;
2828

2929
import java.util.List;
30+
import java.util.concurrent.atomic.LongAdder;
3031

3132
import static org.assertj.core.api.Assertions.assertThat;
32-
import static org.junit.jupiter.api.Assertions.assertEquals;
3333

3434
class SteinerTreeWriteProcTest extends BaseProcTest {
3535

@@ -118,12 +118,27 @@ void testWrittenRelationships() {
118118

119119
runQuery(query);
120120

121-
final long relCount = runQuery(
122-
"MATCH (a)-[:STEINER]->(b) RETURN id(a) AS a, id(b) AS b",
123-
result -> result.stream().count()
121+
var rowCounter = new LongAdder();
122+
runQueryWithRowConsumer(
123+
"MATCH (a)-[r:STEINER]->(b) RETURN id(a) AS a, id(b) AS b, r.cost AS cost",
124+
row -> {
125+
var a = row.getNumber("a").longValue();
126+
assertThat(a)
127+
.as("The source node should be the same as one specified in the procedure configuration")
128+
.isEqualTo(sourceNode);
129+
var b = row.getNumber("b").longValue();
130+
assertThat(b)
131+
.as("The terminal node should be the same as one specified in the procedure configuration")
132+
.isEqualTo(terminalNode);
133+
var writtenCost = row.getNumber("cost").doubleValue();
134+
assertThat(writtenCost)
135+
.as("The relationship property shoud be written correctly")
136+
.isEqualTo(5.4);
137+
138+
rowCounter.increment();
139+
}
124140
);
125141

126-
assertEquals(relCount, 1);
142+
assertThat(rowCounter.longValue()).isEqualTo(1L);
127143
}
128-
129144
}

0 commit comments

Comments
 (0)