File tree Expand file tree Collapse file tree 5 files changed +73
-5
lines changed
Expand file tree Collapse file tree 5 files changed +73
-5
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,11 @@ public abstract class ElementIdentifier {
3030
3131 public final @ NotNull String name ;
3232
33- ElementIdentifier (@ NotNull String name ) {
33+ ElementIdentifier (@ NotNull String name , String type ) {
3434 if (name .equals (ElementProjection .PROJECT_ALL )) {
35- throw new IllegalArgumentException ("name cannot be `*`" );
35+ throw new IllegalArgumentException (type + " cannot be `*`" );
3636 } else if (StringFormatting .isEmpty (name )) {
37- throw new IllegalArgumentException ("name cannot be empty" );
37+ throw new IllegalArgumentException (type + " cannot be empty" );
3838 }
3939 this .name = name ;
4040 }
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public class NodeLabel extends ElementIdentifier {
3030 public static final NodeLabel ALL_NODES = NodeLabel .of ("__ALL__" );
3131
3232 public NodeLabel (String name ) {
33- super (name );
33+ super (name , "Node label" );
3434 }
3535
3636 @ Override
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public class RelationshipType extends ElementIdentifier {
3030 public static final RelationshipType ALL_RELATIONSHIPS = RelationshipType .of ("__ALL__" );
3131
3232 public RelationshipType (String name ) {
33- super (name );
33+ super (name , "Relationship type" );
3434 }
3535
3636 @ Override
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) "Neo4j"
3+ * Neo4j Sweden AB [http://neo4j.com]
4+ *
5+ * This file is part of Neo4j.
6+ *
7+ * Neo4j is free software: you can redistribute it and/or modify
8+ * it under the terms of the GNU General Public License as published by
9+ * the Free Software Foundation, either version 3 of the License, or
10+ * (at your option) any later version.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+ package org .neo4j .gds ;
21+
22+ import org .junit .jupiter .api .Test ;
23+
24+ import static org .assertj .core .api .Assertions .assertThatThrownBy ;
25+
26+ class NodeLabelTest {
27+
28+ @ Test
29+ void failOnInvalidName () {
30+ assertThatThrownBy (() -> new NodeLabel ("" )).isInstanceOf (IllegalArgumentException .class )
31+ .hasMessageMatching ("Node label cannot be empty" );
32+ }
33+
34+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) "Neo4j"
3+ * Neo4j Sweden AB [http://neo4j.com]
4+ *
5+ * This file is part of Neo4j.
6+ *
7+ * Neo4j is free software: you can redistribute it and/or modify
8+ * it under the terms of the GNU General Public License as published by
9+ * the Free Software Foundation, either version 3 of the License, or
10+ * (at your option) any later version.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+ package org .neo4j .gds ;
21+
22+ import org .junit .jupiter .api .Test ;
23+
24+ import static org .assertj .core .api .Assertions .assertThatThrownBy ;
25+
26+ class RelationshipTypeTest {
27+
28+ @ Test
29+ void failOnInvalidName () {
30+ assertThatThrownBy (() -> new RelationshipType ("" )).isInstanceOf (IllegalArgumentException .class )
31+ .hasMessageMatching ("Relationship type cannot be empty" );
32+ }
33+
34+ }
You can’t perform that action at this time.
0 commit comments