Skip to content

Commit 56a2b82

Browse files
Make KCoreDecompositionWriteProcTest.java order indifferent
1 parent ee2cd67 commit 56a2b82

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

proc/community/src/test/java/org/neo4j/gds/kcore/KCoreDecompositionWriteProcTest.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.neo4j.gds.extension.Inject;
3030
import org.neo4j.gds.extension.Neo4jGraph;
3131

32-
import java.util.List;
3332
import java.util.Map;
3433

3534
import static org.assertj.core.api.Assertions.assertThat;
@@ -83,8 +82,19 @@ void setup() throws Exception {
8382
@Test
8483
void shouldWrite(){
8584

86-
String query="CALL gds.kcore.write('graph', { writeProperty: 'coreValue'})";
8785

86+
String query="CALL gds.kcore.write('graph', { writeProperty: 'coreValue'})";
87+
var expectedResultMap = Map.of
88+
(idFunction.of("z"), 0L,
89+
idFunction.of("a"), 1L,
90+
idFunction.of("b"), 1L,
91+
idFunction.of("c"), 2L,
92+
idFunction.of("d"), 2L,
93+
idFunction.of("e"), 2L,
94+
idFunction.of("f"), 2L,
95+
idFunction.of("g"), 2L,
96+
idFunction.of("h"), 2L
97+
);
8898
var rowCount = runQueryWithRowConsumer(query, row -> {
8999

90100
assertThat(row.getNumber("preProcessingMillis"))
@@ -127,20 +137,15 @@ void shouldWrite(){
127137
.as("`write` mode should always return one row")
128138
.isEqualTo(1);
129139

130-
assertCypherResult(
140+
var verificationRowCount = runQueryWithRowConsumer(
131141
"MATCH (n:node) RETURN id(n) AS nodeId, n.coreValue AS coreValue",
132-
List.of(
133-
Map.of("nodeId", idFunction.of("z"), "coreValue", 0L),
134-
Map.of("nodeId", idFunction.of("a"), "coreValue", 1L),
135-
Map.of("nodeId", idFunction.of("b"), "coreValue", 1L),
136-
Map.of("nodeId", idFunction.of("c"), "coreValue", 2L),
137-
Map.of("nodeId", idFunction.of("d"), "coreValue", 2L),
138-
Map.of("nodeId", idFunction.of("e"), "coreValue", 2L),
139-
Map.of("nodeId", idFunction.of("f"), "coreValue", 2L),
140-
Map.of("nodeId", idFunction.of("g"), "coreValue", 2L),
141-
Map.of("nodeId", idFunction.of("h"), "coreValue", 2L)
142-
)
142+
(resultRow) -> {
143+
var nodeId = resultRow.getNumber("nodeId");
144+
var expected = expectedResultMap.get(nodeId);
145+
assertThat(resultRow.getNumber("coreValue")).asInstanceOf(LONG).isEqualTo(expected);
146+
}
143147
);
148+
assertThat(verificationRowCount).isEqualTo(9L);
144149
}
145150

146151
@Test

0 commit comments

Comments
 (0)