From 5822f7d357e3ceda928fb696249a9007afc1a80b Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 28 Jun 2021 07:21:05 +0100 Subject: [PATCH] Add @Nullable to TestGraphQlError --- .../graphql/test/tester/TestGraphQlError.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQlError.java b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQlError.java index 85c613f7..699905c6 100644 --- a/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQlError.java +++ b/spring-graphql-test/src/main/java/org/springframework/graphql/test/tester/TestGraphQlError.java @@ -27,6 +27,8 @@ import graphql.GraphqlErrorBuilder; import graphql.execution.ResultPath; import graphql.language.SourceLocation; +import org.springframework.lang.Nullable; + /** * {@link GraphQLError} with setters to use for deserialization. * @@ -34,59 +36,74 @@ import graphql.language.SourceLocation; */ class TestGraphQlError implements GraphQLError { + @Nullable private String message; + @Nullable private List locations; + @Nullable private ErrorClassification errorType; + @Nullable private List path; + @Nullable private Map extensions; private boolean expected; + @SuppressWarnings("unused") void setMessage(String message) { this.message = message; } @Override + @Nullable public String getMessage() { return this.message; } + @SuppressWarnings("unused") void setLocations(List locations) { this.locations = TestSourceLocation.toSourceLocations(locations); } @Override + @Nullable public List getLocations() { return this.locations; } + @SuppressWarnings("unused") void setErrorType(ErrorClassification errorType) { this.errorType = errorType; } @Override + @Nullable public ErrorClassification getErrorType() { return this.errorType; } + @SuppressWarnings("unused") void setPath(List path) { this.path = path; } @Override + @Nullable public List getPath() { return this.path; } + @SuppressWarnings("unused") void setExtensions(Map extensions) { this.extensions = extensions; } @Override + @Nullable public Map getExtensions() { return this.extensions; } @@ -136,35 +153,43 @@ class TestGraphQlError implements GraphQLError { private int column; + @Nullable private String sourceName; + @SuppressWarnings("unused") void setLine(int line) { this.line = line; } + @SuppressWarnings("unused") int getLine() { return this.line; } + @SuppressWarnings("unused") void setColumn(int column) { this.column = column; } + @SuppressWarnings("unused") int getColumn() { return this.column; } + @SuppressWarnings("unused") void setSourceName(String sourceName) { this.sourceName = sourceName; } + @Nullable + @SuppressWarnings("unused") String getSourceName() { return this.sourceName; } static List toSourceLocations(List locations) { return locations.stream() - .map((location) -> new SourceLocation(location.line, location.column, location.sourceName)) + .map(loc -> new SourceLocation(loc.line, loc.column, loc.sourceName)) .collect(Collectors.toList()); }