|
27 | 27 | import org.neo4j.gds.extension.Neo4jGraph; |
28 | 28 |
|
29 | 29 | import java.util.List; |
| 30 | +import java.util.concurrent.atomic.LongAdder; |
30 | 31 |
|
31 | 32 | import static org.assertj.core.api.Assertions.assertThat; |
32 | | -import static org.junit.jupiter.api.Assertions.assertEquals; |
33 | 33 |
|
34 | 34 | class SteinerTreeWriteProcTest extends BaseProcTest { |
35 | 35 |
|
@@ -118,12 +118,27 @@ void testWrittenRelationships() { |
118 | 118 |
|
119 | 119 | runQuery(query); |
120 | 120 |
|
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 | + } |
124 | 140 | ); |
125 | 141 |
|
126 | | - assertEquals(relCount, 1); |
| 142 | + assertThat(rowCounter.longValue()).isEqualTo(1L); |
127 | 143 | } |
128 | | - |
129 | 144 | } |
0 commit comments