Skip to content

Commit 8c032cb

Browse files
committed
Document sparseness trick in test
1 parent 28ccd32 commit 8c032cb

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

proc/community/src/test/java/org/neo4j/gds/CommunityProcCompanionTest.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ void minComponentSizeWithSparseProperties() {
164164
inputBuilder.set(3, 42);
165165
var input = inputBuilder.build();
166166

167+
// we mimic the sparseness here through size > valueStored
167168
LongNodePropertyValues sparseProperties = new TestSparseNodePropertyValues(4, 3, input::get);
168169

169170
var config = ConfigWithComponentSize.of(CypherMapWrapper.empty().withNumber("minComponentSize", 2L));
@@ -175,10 +176,8 @@ void minComponentSizeWithSparseProperties() {
175176
() -> { throw new UnsupportedOperationException("Not implemented"); }
176177
);
177178

178-
// null from the beginning
179179
assertThat(filteredProperties.value(0)).isNull();
180180
assertThat(filteredProperties.value(1)).isEqualTo(Values.longValue(42));
181-
// filtered out
182181
assertThat(filteredProperties.value(2)).isNull();
183182
assertThat(filteredProperties.value(3)).isEqualTo(Values.longValue(42));
184183
}
@@ -191,6 +190,7 @@ void consecutiveIdsWithSparseProperties() {
191190
inputBuilder.set(3, 42);
192191
var input = inputBuilder.build();
193192

193+
// we mimic the sparseness here through size > valueStored
194194
LongNodePropertyValues sparseProperties = new TestSparseNodePropertyValues(4, 3, input::get);
195195

196196
var config = ConfigWithComponentSize.of(CypherMapWrapper.create(Map.of("consecutiveIds", true)));
@@ -202,12 +202,10 @@ void consecutiveIdsWithSparseProperties() {
202202
() -> { throw new UnsupportedOperationException("Not implemented"); }
203203
);
204204

205-
// null from the beginning
206-
assertThat(filteredProperties.value(0)).isNull();
207-
assertThat(filteredProperties.value(1)).isEqualTo(Values.longValue(0));
208-
// filtered out
209-
assertThat(filteredProperties.value(2)).isEqualTo(Values.longValue(1));
210-
assertThat(filteredProperties.value(3)).isEqualTo(Values.longValue(0));
205+
assertThat(filteredProperties.value(0)).isEqualTo(Values.longValue(0));
206+
assertThat(filteredProperties.value(1)).isEqualTo(Values.longValue(1));
207+
assertThat(filteredProperties.value(2)).isEqualTo(Values.longValue(2));
208+
assertThat(filteredProperties.value(3)).isEqualTo(Values.longValue(1));
211209
}
212210

213211
private static final class TestNodePropertyValues implements LongNodePropertyValues {

0 commit comments

Comments
 (0)