Make id mandatory for RequestInput
This commit is a follow up of 2e4158c and makes the following changes:
* the id is now a mandatory attribute for `WebInput` and `RequestInput`
* a consistent IdGenerator strategy is configured for all requests
Closes gh-183
This commit is contained in:
@@ -21,7 +21,9 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.graphql.RequestInput;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.AlternativeJdkIdGenerator;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.IdGenerator;
|
||||
|
||||
/**
|
||||
* Base class support for implementations of
|
||||
@@ -32,6 +34,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
class GraphQlTesterRequestSpecSupport {
|
||||
|
||||
private static final IdGenerator idGenerator = new AlternativeJdkIdGenerator();
|
||||
|
||||
private final String query;
|
||||
|
||||
@Nullable
|
||||
@@ -66,7 +70,7 @@ class GraphQlTesterRequestSpecSupport {
|
||||
}
|
||||
|
||||
protected RequestInput createRequestInput() {
|
||||
return new RequestInput(this.query, this.operationName, this.variables, this.locale, null);
|
||||
return new RequestInput(this.query, this.operationName, this.variables, this.locale, idGenerator.generateId().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user