Skip to content

Commit 71ef680

Browse files
committed
Update test for Argument, and make nonnullable field clearer
1 parent fd3b4af commit 71ef680

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/graphql/language/Argument.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class Argument extends AbstractNode<Argument> implements NamedNode<Argume
3232
@Internal
3333
protected Argument(String name, Value value, @Nullable SourceLocation sourceLocation, List<Comment> comments, IgnoredChars ignoredChars, Map<String, String> additionalData) {
3434
super(sourceLocation, comments, ignoredChars, additionalData);
35-
this.name = name;
35+
this.name = assertNotNull(name, () -> "Argument name cannot be null");
3636
this.value = assertNotNull(value, () -> "Argument value cannot be null");
3737
}
3838

@@ -99,7 +99,7 @@ public boolean isEqualTo(@Nullable Node o) {
9999

100100
@Override
101101
public Argument deepCopy() {
102-
return new Argument(name, assertNotNull(deepCopy(value), "Argument value cannot be null"), getSourceLocation(), getComments(), getIgnoredChars(), getAdditionalData());
102+
return new Argument(assertNotNull(name, "Argument name cannot be null"), assertNotNull(deepCopy(value), "Argument value cannot be null"), getSourceLocation(), getComments(), getIgnoredChars(), getAdditionalData());
103103
}
104104

105105
@Override

src/test/groovy/graphql/language/NodeVisitorStubTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class NodeVisitorStubTest extends Specification {
132132

133133
where:
134134
node | visitMethod
135-
new Argument("", null) | 'visitArgument'
135+
new Argument("myArgument", NullValue.of()) | 'visitArgument'
136136
new Directive("", emptyList()) | 'visitDirective'
137137
new DirectiveLocation("") | 'visitDirectiveLocation'
138138
Document.newDocument().build() | 'visitDocument'

0 commit comments

Comments
 (0)