|
1 | 1 | /* |
2 | | - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2024 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
55 | 55 | @SuppressWarnings("ReactiveStreamsUnusedPublisher") |
56 | 56 | public class ContextDataFetcherDecoratorTests { |
57 | 57 |
|
58 | | - private static final String SCHEMA_CONTENT = "" + |
59 | | - "directive @UpperCase on FIELD_DEFINITION " + |
60 | | - "type Query { " + |
61 | | - " greeting: String @UpperCase, " + |
62 | | - " greetings: [String] " + |
63 | | - "} " + |
64 | | - "type Subscription { " + |
65 | | - " greetings: String " + |
66 | | - "}"; |
| 58 | + private static final String SCHEMA_CONTENT = """ |
| 59 | + directive @UpperCase on FIELD_DEFINITION \ |
| 60 | + type Query { \ |
| 61 | + greeting: String @UpperCase, \ |
| 62 | + greetings: [String] \ |
| 63 | + } \ |
| 64 | + type Subscription { \ |
| 65 | + greetings: String \ |
| 66 | + }"""; |
67 | 67 |
|
68 | 68 |
|
69 | 69 | @Test |
@@ -241,16 +241,16 @@ else if (value instanceof Mono) { |
241 | 241 | tester.accept(directiveWiring, env -> Mono.just("hello")); |
242 | 242 | } |
243 | 243 |
|
244 | | - @Test //gh-980 |
| 244 | + @Test // gh-980 |
245 | 245 | void trivialDataFetcherIsNotDecorated() { |
246 | 246 | GraphQL graphQl = GraphQlSetup.schemaContent(SCHEMA_CONTENT) |
247 | | - .queryFetcher("greeting", (TrivialDataFetcher) env -> "hello") |
248 | | - .toGraphQl(); |
| 247 | + .queryFetcher("greeting", (TrivialDataFetcher<?>) env -> "hello") |
| 248 | + .toGraphQl(); |
249 | 249 |
|
250 | 250 | GraphQLSchema schema = graphQl.getGraphQLSchema(); |
251 | 251 | FieldCoordinates coordinates = FieldCoordinates.coordinates("Query", "greeting"); |
252 | | - DataFetcher<?> dataFetcher = schema.getCodeRegistry() |
253 | | - .getDataFetcher(coordinates, schema.getFieldDefinition(coordinates)); |
| 252 | + GraphQLFieldDefinition fieldDefinition = schema.getFieldDefinition(coordinates); |
| 253 | + DataFetcher<?> dataFetcher = schema.getCodeRegistry().getDataFetcher(coordinates, fieldDefinition); |
254 | 254 |
|
255 | 255 | assertThat(dataFetcher).isInstanceOf(TrivialDataFetcher.class); |
256 | 256 | } |
|
0 commit comments