|
22 | 22 | import org.junit.jupiter.api.AfterEach; |
23 | 23 | import org.junit.jupiter.api.BeforeEach; |
24 | 24 | import org.junit.jupiter.api.Test; |
| 25 | +import org.junit.jupiter.params.ParameterizedTest; |
| 26 | +import org.junit.jupiter.params.provider.CsvSource; |
25 | 27 | import org.neo4j.gds.BaseProcTest; |
26 | 28 | import org.neo4j.gds.GdsCypher; |
27 | 29 | import org.neo4j.gds.beta.filter.expression.SemanticErrors; |
|
33 | 35 | import java.util.List; |
34 | 36 | import java.util.Map; |
35 | 37 |
|
| 38 | +import static org.assertj.core.api.Assertions.assertThat; |
36 | 39 | import static org.assertj.core.api.Assertions.assertThatThrownBy; |
37 | 40 | import static org.hamcrest.Matchers.greaterThan; |
38 | 41 | import static org.neo4j.gds.TestSupport.assertGraphEquals; |
39 | 42 | import static org.neo4j.gds.TestSupport.fromGdl; |
| 43 | +import static org.neo4j.gds.utils.StringFormatting.formatWithLocale; |
40 | 44 |
|
41 | 45 | class GraphProjectSubgraphProcTest extends BaseProcTest { |
42 | 46 |
|
@@ -165,10 +169,20 @@ void throwsOnSemanticRelationshipError() { |
165 | 169 | .hasMessageContaining("Unknown relationship type `BAR`."); |
166 | 170 | } |
167 | 171 |
|
168 | | - @Test |
169 | | - void shouldResolveParameters() { |
170 | | - var subGraphQuery = "CALL gds.beta.graph.project.subgraph('subgraph', 'graph', 'true', 'r:REL AND r.weight > $weight', { parameterMap: { weight: $weight } })"; |
| 172 | + @ParameterizedTest |
| 173 | + @CsvSource({ |
| 174 | + "=, 1", |
| 175 | + ">, 0" |
| 176 | + }) |
| 177 | + void shouldResolveParameters(String operator, int expectedRelationships) { |
| 178 | + var subGraphQuery = formatWithLocale( |
| 179 | + "CALL gds.beta.graph.project.subgraph('subgraph', 'graph', 'true', 'r:REL AND r.weight %s $weight', { parameterMap: { weight: $weight } })", |
| 180 | + operator |
| 181 | + ); |
171 | 182 |
|
172 | 183 | runQuery(subGraphQuery, Map.of("weight", 42)); |
| 184 | + |
| 185 | + var graphStore = GraphStoreCatalog.get("", db.databaseId(), "subgraph").graphStore(); |
| 186 | + assertThat(graphStore.relationshipCount()).isEqualTo(expectedRelationships); |
173 | 187 | } |
174 | 188 | } |
0 commit comments