Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ type Profile {
GraphQLFieldDefinition onField(SchemaDirectiveWiringEnvironment<GraphQLFieldDefinition> env) {
GraphQLFieldsContainer fieldsContainer = env.getFieldsContainer()
GraphQLFieldDefinition fieldDefinition = env.getFieldDefinition()
if (! fieldsContainer instanceof GraphQLObjectType) {
if (!(fieldsContainer instanceof GraphQLObjectType)) {
return fieldDefinition
}
GraphQLObjectType containingObjectType = env.getFieldsContainer() as GraphQLObjectType
Expand Down
19 changes: 7 additions & 12 deletions src/test/groovy/graphql/execution/ExecutionStrategyTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -477,27 +477,22 @@ class ExecutionStrategyTest extends Specification {

when:
def parameters = newParameters()
.executionStepInfo(ExecutionStepInfo.newExecutionStepInfo().type(fieldType))
.executionStepInfo(typeInfo)
.source(result)
.fields(mergedSelectionSet(["dummy": []]))
.nonNullFieldValidator(nullableFieldValidator)
.build()

Exception actualException = null
Throwable actualException = null
try {
executionStrategy.completeValue(executionContext, parameters)
} catch (Exception e) {
actualException = e
executionStrategy.completeValue(executionContext, parameters).fieldValueFuture.join()
} catch (CompletionException e) {
actualException = e.cause
}

then:
if (errorExpected) {
actualException instanceof NonNullableFieldWasNullException
executionContext.errors.size() == 1
} else {
actualException != null
executionContext.errors.size() == 0
}
(actualException instanceof NonNullableFieldWasNullException) == errorExpected
executionContext.errors.size() == (errorExpected ? 1 : 0)


where:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ class SubscriptionExecutionStrategyTest extends Specification {
for (int i = 0; i < messages.size(); i++) {
def message = messages[i]
if (i == 5) {
message.data == null
assert message.data == ["newMessage": null]
assert message.errors.size() == 2
assert message.errors[0].errorType == ErrorType.NullValueInNonNullableField
assert message.errors[0].message.contains("/newMessage/sender")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ class DeferWithDataLoaderTest extends Specification {

if (contextKey == ENABLE_DATA_LOADER_EXHAUSTED_DISPATCHING) {
// based on the timing of shops vs expensiveShops DF it could be one or two batch loader calls
batchCompareDataFetchers.departmentsForShopsBatchLoaderCounter.get() == 1 || batchCompareDataFetchers.departmentsForShopsBatchLoaderCounter.get() == 2
assert batchCompareDataFetchers.departmentsForShopsBatchLoaderCounter.get() == 1 || batchCompareDataFetchers.departmentsForShopsBatchLoaderCounter.get() == 2
} else {
batchCompareDataFetchers.departmentsForShopsBatchLoaderCounter.get() == 1
assert batchCompareDataFetchers.departmentsForShopsBatchLoaderCounter.get() == 1

}
batchCompareDataFetchers.productsForDepartmentsBatchLoaderCounter.get() == 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class SchemaGeneratorDirectiveHelperTest extends Specification {
GraphQLFieldDefinition onField(SchemaDirectiveWiringEnvironment<GraphQLFieldDefinition> directiveEnv) {
GraphQLFieldDefinition field = directiveEnv.getElement()
def container = directiveEnv.fieldsContainer
if (!container instanceof GraphQLObjectType) {
if (!(container instanceof GraphQLObjectType)) {
return field
}
//
Expand Down Expand Up @@ -491,7 +491,7 @@ class SchemaGeneratorDirectiveHelperTest extends Specification {
GraphQLFieldDefinition element = environment.getElement()

def container = environment.fieldsContainer
if (! container instanceof GraphQLObjectType) {
if (!(container instanceof GraphQLObjectType)) {
return element
}
return wrapField(container as GraphQLObjectType, element, environment.getBuildContext(), environment.getCodeRegistry())
Expand Down