From 2c6ef91dc04dcffce7d5a24eae9c49f41bc14253 Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Thu, 30 May 2024 11:51:00 +0100 Subject: [PATCH] Polishing contribution Closes gh-983 --- .../ContextDataFetcherDecoratorTests.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/spring-graphql/src/test/java/org/springframework/graphql/execution/ContextDataFetcherDecoratorTests.java b/spring-graphql/src/test/java/org/springframework/graphql/execution/ContextDataFetcherDecoratorTests.java index 83481cc4..ab9968e6 100644 --- a/spring-graphql/src/test/java/org/springframework/graphql/execution/ContextDataFetcherDecoratorTests.java +++ b/spring-graphql/src/test/java/org/springframework/graphql/execution/ContextDataFetcherDecoratorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,15 +55,15 @@ import static org.assertj.core.api.Assertions.assertThat; @SuppressWarnings("ReactiveStreamsUnusedPublisher") public class ContextDataFetcherDecoratorTests { - private static final String SCHEMA_CONTENT = "" + - "directive @UpperCase on FIELD_DEFINITION " + - "type Query { " + - " greeting: String @UpperCase, " + - " greetings: [String] " + - "} " + - "type Subscription { " + - " greetings: String " + - "}"; + private static final String SCHEMA_CONTENT = """ + directive @UpperCase on FIELD_DEFINITION \ + type Query { \ + greeting: String @UpperCase, \ + greetings: [String] \ + } \ + type Subscription { \ + greetings: String \ + }"""; @Test @@ -241,16 +241,16 @@ public class ContextDataFetcherDecoratorTests { tester.accept(directiveWiring, env -> Mono.just("hello")); } - @Test //gh-980 + @Test // gh-980 void trivialDataFetcherIsNotDecorated() { GraphQL graphQl = GraphQlSetup.schemaContent(SCHEMA_CONTENT) - .queryFetcher("greeting", (TrivialDataFetcher) env -> "hello") - .toGraphQl(); + .queryFetcher("greeting", (TrivialDataFetcher) env -> "hello") + .toGraphQl(); GraphQLSchema schema = graphQl.getGraphQLSchema(); FieldCoordinates coordinates = FieldCoordinates.coordinates("Query", "greeting"); - DataFetcher dataFetcher = schema.getCodeRegistry() - .getDataFetcher(coordinates, schema.getFieldDefinition(coordinates)); + GraphQLFieldDefinition fieldDefinition = schema.getFieldDefinition(coordinates); + DataFetcher dataFetcher = schema.getCodeRegistry().getDataFetcher(coordinates, fieldDefinition); assertThat(dataFetcher).isInstanceOf(TrivialDataFetcher.class); }