Skip to content

Commit 4cde7e2

Browse files
authored
Merge pull request #5404 from Mats-SX/windows-newline-contrib
Platform-agnostic newlines
2 parents 1b3d583 + edfc03a commit 4cde7e2

File tree

8 files changed

+75
-62
lines changed

8 files changed

+75
-62
lines changed

algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static ImmutableNodeSimilarityWriteConfig.Builder configBuilder() {
162162
.similarityCutoff(0.0);
163163
}
164164
private static String resultString(long node1, long node2, double similarity) {
165-
return formatWithLocale("%d,%d %f%n", node1, node2, similarity);
165+
return formatWithLocale("%d,%d %f", node1, node2, similarity);
166166
}
167167

168168
private static String resultString(SimilarityResult result) {
@@ -881,7 +881,7 @@ void shouldGiveCorrectResultsWithOverlap() {
881881
.map(NodeSimilarityTest::resultString)
882882
.collect(Collectors.toSet());
883883

884-
assertThat(result).contains("0,1 0.500000\n" );
884+
assertThat(result).contains("0,1 0.500000");
885885

886886
nodeSimilarity = new NodeSimilarity(
887887
graph,
@@ -895,7 +895,7 @@ void shouldGiveCorrectResultsWithOverlap() {
895895
.map(NodeSimilarityTest::resultString)
896896
.collect(Collectors.toSet());
897897

898-
assertThat(result).contains("0,1 0.333333\n" );
898+
assertThat(result).contains("0,1 0.333333");
899899

900900
}
901901

alpha/alpha-proc/src/test/java/org/neo4j/gds/scc/SccDocTest.java

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class SccDocTest extends BaseProcTest {
4848
"CREATE (nBridget)-[:FOLLOW]->(nAlice) " +
4949
"CREATE (nMichael)-[:FOLLOW]->(nBridget); ";
5050

51+
private static final String newLine = System.lineSeparator();
52+
5153
@BeforeEach
5254
void setup() throws Exception {
5355
runQuery(DB_CYPHER);
@@ -64,17 +66,17 @@ void stream1() {
6466
"RETURN gds.util.asNode(nodeId).name AS Name, componentId AS Component " +
6567
"ORDER BY Component DESC";
6668

67-
String expected = "+-----------------------+\n" +
68-
"| Name | Component |\n" +
69-
"+-----------------------+\n" +
70-
"| \"Doug\" | 3 |\n" +
71-
"| \"Mark\" | 3 |\n" +
72-
"| \"Charles\" | 2 |\n" +
73-
"| \"Alice\" | 0 |\n" +
74-
"| \"Bridget\" | 0 |\n" +
75-
"| \"Michael\" | 0 |\n" +
76-
"+-----------------------+\n" +
77-
"6 rows\n";
69+
String expected = "+-----------------------+" + newLine +
70+
"| Name | Component |" + newLine +
71+
"+-----------------------+" + newLine +
72+
"| \"Doug\" | 3 |" + newLine +
73+
"| \"Mark\" | 3 |" + newLine +
74+
"| \"Charles\" | 2 |" + newLine +
75+
"| \"Alice\" | 0 |" + newLine +
76+
"| \"Bridget\" | 0 |" + newLine +
77+
"| \"Michael\" | 0 |" + newLine +
78+
"+-----------------------+" + newLine +
79+
"6 rows" + newLine;
7880

7981
assertEquals(expected, runQuery(query, Result::resultAsString));
8082
}
@@ -86,12 +88,12 @@ void write1() {
8688
"}) " +
8789
"YIELD setCount, maxSetSize, minSetSize; ";
8890

89-
String expected = "+------------------------------------+\n" +
90-
"| setCount | maxSetSize | minSetSize |\n" +
91-
"+------------------------------------+\n" +
92-
"| 3 | 3 | 1 |\n" +
93-
"+------------------------------------+\n" +
94-
"1 row\n";
91+
String expected = "+------------------------------------+" + newLine +
92+
"| setCount | maxSetSize | minSetSize |" + newLine +
93+
"+------------------------------------+" + newLine +
94+
"| 3 | 3 | 1 |" + newLine +
95+
"+------------------------------------+" + newLine +
96+
"1 row" + newLine;
9597

9698
assertEquals(expected, runQuery(query, Result::resultAsString));
9799
}
@@ -109,12 +111,12 @@ void findLargest() {
109111
"ORDER BY PartitionSize DESC " +
110112
"LIMIT 1 ";
111113

112-
String expected = "+---------------------------+\n" +
113-
"| Component | PartitionSize |\n" +
114-
"+---------------------------+\n" +
115-
"| 0 | 3 |\n" +
116-
"+---------------------------+\n" +
117-
"1 row\n";
114+
String expected = "+---------------------------+" + newLine +
115+
"| Component | PartitionSize |" + newLine +
116+
"+---------------------------+" + newLine +
117+
"| 0 | 3 |" + newLine +
118+
"+---------------------------+" + newLine +
119+
"1 row" + newLine;
118120

119121
assertEquals(expected, runQuery(query, Result::resultAsString));
120122
}

doc-test/src/test/java/org/neo4j/gds/doc/syntax/ProcedureSyntaxAutoCheckerTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class ProcedureSyntaxAutoCheckerTest {
4646
private File outputDirectory;
4747
private OptionsBuilder options;
4848

49+
private static final String newLine = System.lineSeparator();
50+
4951
@BeforeEach
5052
void setUp() {
5153
// By default we are forced to use relative path which we don't want.
@@ -149,7 +151,7 @@ void shouldFailOnMissingYieldResultColumns() throws URISyntaxException {
149151
.hasSize(1)
150152
.allSatisfy(assertionError -> assertThat(assertionError)
151153
.hasMessageContaining("Asserting YIELD result columns for `include-with-stream`")
152-
.hasMessageContaining("could not find the following elements:\n" +
154+
.hasMessageContaining("could not find the following elements:" + newLine +
153155
" [\"communityId\", \"intermediateCommunityIds\"]"));
154156
}
155157

@@ -172,7 +174,7 @@ void shouldFailOnExtraYieldResultColumns() throws URISyntaxException {
172174
.hasSize(1)
173175
.allSatisfy(assertionError -> assertThat(assertionError)
174176
.hasMessageContaining("Asserting YIELD result columns for `include-with-stream`")
175-
.hasMessageContaining("the following elements were unexpected:\n" +
177+
.hasMessageContaining("the following elements were unexpected:" + newLine +
176178
" [\"bogusResultColumn\"]"));
177179
}
178180

@@ -195,7 +197,7 @@ void shouldFailOnMissingResultTableRows() throws URISyntaxException {
195197
.hasSize(1)
196198
.allSatisfy(assertionError -> assertThat(assertionError)
197199
.hasMessageContaining("Asserting `Results` table for `include-with-stream`")
198-
.hasMessageContaining("could not find the following elements:\n" +
200+
.hasMessageContaining("could not find the following elements:" + newLine +
199201
" [\"intermediateCommunityIds\"]"));
200202
}
201203

@@ -218,7 +220,7 @@ void shouldFailOnExtraResultTableRows() throws URISyntaxException {
218220
.hasSize(1)
219221
.allSatisfy(assertionError -> assertThat(assertionError)
220222
.hasMessageContaining("Asserting `Results` table for `include-with-stream`")
221-
.hasMessageContaining("the following elements were unexpected:\n" +
223+
.hasMessageContaining("the following elements were unexpected:" + newLine +
222224
" [\"bogusResultColumn\"]"));
223225
}
224226

proc/catalog/src/test/java/org/neo4j/gds/catalog/ConfigKeyValidationTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
class ConfigKeyValidationTest extends BaseProcTest {
3434

35+
private static final String newLine = System.lineSeparator();
36+
3537
@BeforeEach
3638
void setup() throws Exception {
3739
registerProcedures(GraphProjectProc.class, TestProc.class);
@@ -145,8 +147,8 @@ void returnMultipleErrorsInConfigConstructionAtOnce() {
145147
() -> runQuery(formatWithLocale("CALL gds.testProc.write('%s', {maxIterations: [1]})", DEFAULT_GRAPH_NAME))
146148
);
147149

148-
String expectedMsg = "Multiple errors in configuration arguments:\n" +
149-
"\t\t\t\tThe value of `maxIterations` must be of type `Integer` but was `ArrayList`.\n" +
150+
String expectedMsg = "Multiple errors in configuration arguments:" + newLine +
151+
"\t\t\t\tThe value of `maxIterations` must be of type `Integer` but was `ArrayList`." + newLine +
150152
"\t\t\t\tNo value specified for the mandatory configuration parameter `writeProperty`";
151153
assertThat(
152154
exception,

proc/catalog/src/test/java/org/neo4j/gds/catalog/GraphProjectProcTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
class GraphProjectProcTest extends BaseProcTest {
104104

105105
private static final String DB_CYPHER = "CREATE (:A {age: 2})-[:REL {weight: 55}]->(:A)";
106+
private static final String newLine = System.lineSeparator();
106107

107108
@BeforeEach
108109
void setup() throws Exception {
@@ -1188,8 +1189,8 @@ void failsOnEmptyProjection(String projection) {
11881189
void failsOnBothEmptyProjection() {
11891190
String query = "CALL gds.graph.project('g','','')";
11901191

1191-
String expectedMsg = "Multiple errors in configuration arguments:\n" +
1192-
"\t\t\t\tAn empty node projection was given; at least one node label must be projected.\n" +
1192+
String expectedMsg = "Multiple errors in configuration arguments:" + newLine +
1193+
"\t\t\t\tAn empty node projection was given; at least one node label must be projected." + newLine +
11931194
"\t\t\t\tAn empty relationship projection was given; at least one relationship type must be projected.";
11941195

11951196
assertError(

proc/machine-learning/src/test/java/org/neo4j/gds/ml/linkmodels/pipeline/LinkPredictionPipelineAddTrainerMethodProcsTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
class LinkPredictionPipelineAddTrainerMethodProcsTest extends BaseProcTest {
3838

39+
private static final String newLine = System.lineSeparator();
40+
3941
@BeforeEach
4042
void setUp() throws Exception {
4143
registerProcedures(LinkPredictionPipelineAddTrainerMethodProcs.class, LinkPredictionPipelineCreateProc.class);
@@ -146,8 +148,8 @@ void addRandomForest() {
146148
void failOnInvalidParameterValues() {
147149
assertError(
148150
"CALL gds.beta.pipeline.linkPrediction.addLogisticRegression('myPipeline', {minEpochs: 0.5, batchSize: 0.51})",
149-
"Multiple errors in configuration arguments:\n" +
150-
"\t\t\t\tThe value of `batchSize` must be of type `Integer` but was `Double`.\n" +
151+
"Multiple errors in configuration arguments:" + newLine +
152+
"\t\t\t\tThe value of `batchSize` must be of type `Integer` but was `Double`." + newLine +
151153
"\t\t\t\tThe value of `minEpochs` must be of type `Integer` but was `Double`."
152154
);
153155
}

proc/machine-learning/src/test/java/org/neo4j/gds/ml/pipeline/node/classification/NodeClassificationPipelineAddTrainerMethodProcsTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
class NodeClassificationPipelineAddTrainerMethodProcsTest extends BaseProcTest {
3737

38+
private static final String newLine = System.lineSeparator();
39+
3840
@BeforeEach
3941
void setUp() throws Exception {
4042
registerProcedures(NodeClassificationPipelineAddTrainerMethodProcs.class, NodeClassificationPipelineCreateProc.class);
@@ -143,8 +145,8 @@ void shouldKeepBothConfigs() {
143145
void failOnInvalidParameterValues() {
144146
assertError(
145147
"CALL gds.beta.pipeline.nodeClassification.addLogisticRegression('myPipeline', {minEpochs: 0.5, batchSize: 0.51})",
146-
"Multiple errors in configuration arguments:\n" +
147-
"\t\t\t\tThe value of `batchSize` must be of type `Integer` but was `Double`.\n" +
148+
"Multiple errors in configuration arguments:" + newLine +
149+
"\t\t\t\tThe value of `batchSize` must be of type `Integer` but was `Double`." + newLine +
148150
"\t\t\t\tThe value of `minEpochs` must be of type `Integer` but was `Double`."
149151
);
150152
}

test-utils/src/test/java/org/neo4j/gds/core/CypherExporterTest.java

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,19 @@
3434

3535
final class CypherExporterTest extends BaseTest {
3636

37+
private static final String newLine = System.lineSeparator();
38+
3739
@BeforeEach
3840
void setup() {
3941
String createGraph =
40-
"CREATE (nA:Label1 { foo: 'bar' })\n" +
41-
"CREATE (nB:Label1 { property: 42.1337 })\n" +
42-
"CREATE (nC:Label2)\n" +
43-
"CREATE (nD)\n" +
44-
"CREATE\n" +
45-
" (nA)-[:TYPE1 {bar: 'baz'}]->(nB),\n" +
46-
" (nA)-[:TYPE1 {property:1337.42}]->(nC),\n" +
47-
" (nB)-[:TYPE2]->(nC),\n" +
42+
"CREATE (nA:Label1 { foo: 'bar' }) " +
43+
"CREATE (nB:Label1 { property: 42.1337 }) " +
44+
"CREATE (nC:Label2) " +
45+
"CREATE (nD) " +
46+
"CREATE " +
47+
" (nA)-[:TYPE1 {bar: 'baz'}]->(nB), " +
48+
" (nA)-[:TYPE1 {property:1337.42}]->(nC), " +
49+
" (nB)-[:TYPE2]->(nC), " +
4850
" (nC)-[:TYPE]->(nD)";
4951

5052
runQuery(createGraph);
@@ -57,14 +59,14 @@ void testDumpByGraphDbApi() {
5759

5860
//language=Cypher
5961
String expected =
60-
"CREATE (n0:Label1 {foo:bar})\n" +
61-
"CREATE (n1:Label1 {property:42.1337})\n" +
62-
"CREATE (n2:Label2)\n" +
63-
"CREATE (n3)\n" +
64-
"CREATE\n" +
65-
" (n0)-[:TYPE1 {property:1337.42}]->(n2),\n" +
66-
" (n0)-[:TYPE1 {bar:baz}]->(n1),\n" +
67-
" (n1)-[:TYPE2]->(n2),\n" +
62+
"CREATE (n0:Label1 {foo:bar})" + newLine +
63+
"CREATE (n1:Label1 {property:42.1337})" + newLine +
64+
"CREATE (n2:Label2)" + newLine +
65+
"CREATE (n3)" + newLine +
66+
"CREATE" + newLine +
67+
" (n0)-[:TYPE1 {property:1337.42}]->(n2)," + newLine +
68+
" (n0)-[:TYPE1 {bar:baz}]->(n1)," + newLine +
69+
" (n1)-[:TYPE2]->(n2)," + newLine +
6870
" (n2)-[:TYPE]->(n3);";
6971

7072
assertEquals(expected, output.toString().trim());
@@ -74,14 +76,14 @@ void testDumpByGraphDbApi() {
7476
void testDumpByGraphForHuge() {
7577
//language=Cypher
7678
String expected =
77-
"CREATE (n0 {property:42.0})\n" +
78-
"CREATE (n1 {property:42.1337})\n" +
79-
"CREATE (n2 {property:42.0})\n" +
80-
"CREATE (n3 {property:42.0})\n" +
81-
"CREATE\n" +
82-
" (n0)-[ {weight:42.0}]->(n1),\n" +
83-
" (n0)-[ {weight:1337.42}]->(n2),\n" +
84-
" (n1)-[ {weight:42.0}]->(n2),\n" +
79+
"CREATE (n0 {property:42.0})" + newLine +
80+
"CREATE (n1 {property:42.1337})" + newLine +
81+
"CREATE (n2 {property:42.0})" + newLine +
82+
"CREATE (n3 {property:42.0})" + newLine +
83+
"CREATE" + newLine +
84+
" (n0)-[ {weight:42.0}]->(n1)," + newLine +
85+
" (n0)-[ {weight:1337.42}]->(n2)," + newLine +
86+
" (n1)-[ {weight:42.0}]->(n2)," + newLine +
8587
" (n2)-[ {weight:42.0}]->(n3);";
8688

8789
String output = dumpGraph();

0 commit comments

Comments
 (0)