Skip to content

Commit 6d72580

Browse files
committed
fix tests
1 parent 442f344 commit 6d72580

17 files changed

+521
-340
lines changed

src/test/java/graphql/annotations/DefaultTypeFunctionTest.java

Lines changed: 0 additions & 305 deletions
This file was deleted.

src/test/java/graphql/annotations/GraphQLExtensionsTest.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
* <p>
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -95,7 +95,8 @@ public Object get(DataFetchingEnvironment environment) {
9595
public void fields() {
9696
GraphQLAnnotations instance = new GraphQLAnnotations();
9797
instance.registerTypeExtension(TestObjectExtension.class);
98-
GraphQLObjectType object = instance.getObject(GraphQLExtensionsTest.TestObject.class);
98+
GraphQLObjectHandler graphQLObjectHandler = new GraphQLObjectHandler();
99+
GraphQLObjectType object = graphQLObjectHandler.getObject(GraphQLExtensionsTest.TestObject.class, instance.getContainer());
99100
instance.unregisterTypeExtension(TestObjectExtension.class);
100101

101102
List<GraphQLFieldDefinition> fields = object.getFieldDefinitions();
@@ -114,7 +115,8 @@ public void fields() {
114115
public void values() {
115116
GraphQLAnnotations instance = new GraphQLAnnotations();
116117
instance.registerTypeExtension(TestObjectExtension.class);
117-
GraphQLObjectType object = instance.getObject(GraphQLExtensionsTest.TestObject.class);
118+
GraphQLObjectHandler graphQLObjectHandler = new GraphQLObjectHandler();
119+
GraphQLObjectType object = graphQLObjectHandler.getObject(GraphQLExtensionsTest.TestObject.class, instance.getContainer());
118120
instance.unregisterTypeExtension(TestObjectExtension.class);
119121

120122
GraphQLSchema schema = newSchema().query(object).build();
@@ -132,8 +134,9 @@ public void values() {
132134
@Test
133135
public void testDuplicateField() {
134136
GraphQLAnnotations instance = new GraphQLAnnotations();
137+
GraphQLObjectHandler graphQLObjectHandler = new GraphQLObjectHandler();
135138
instance.registerTypeExtension(TestObjectExtensionInvalid.class);
136-
GraphQLAnnotationsException e = expectThrows(GraphQLAnnotationsException.class, () -> instance.getObject(TestObject.class));
139+
GraphQLAnnotationsException e = expectThrows(GraphQLAnnotationsException.class, () -> graphQLObjectHandler.getObject(TestObject.class,instance.getContainer()));
137140
assertTrue(e.getMessage().startsWith("Duplicate field"));
138141
instance.unregisterTypeExtension(TestObjectExtensionInvalid.class);
139142
}

src/test/java/graphql/annotations/GraphQLFragmentTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public void init() {
5050
public void testInterfaceInlineFragment() throws Exception {
5151
// Given
5252
registry = new HashMap<>();
53+
GraphQLInterfaceRetriever graphQLInterfaceRetriever=new GraphQLInterfaceRetriever();
5354

54-
GraphQLInterfaceType iface = (GraphQLInterfaceType) GraphQLAnnotations.iface(MyInterface.class);
5555

5656
GraphQLObjectType rootType = GraphQLAnnotations.object(RootObject.class);
5757

@@ -63,6 +63,8 @@ public void testInterfaceInlineFragment() throws Exception {
6363

6464
registry.put("MyObject", objectType);
6565

66+
GraphQLInterfaceType iface = (GraphQLInterfaceType) graphQLInterfaceRetriever.getInterface(MyInterface.class,GraphQLAnnotations.getInstance().getContainer());
67+
6668
GraphQLSchema schema = GraphQLSchema.newSchema()
6769
.query(rootType)
6870
.build(new HashSet<>(Arrays.<graphql.schema.GraphQLType>asList(iface, objectType)));

0 commit comments

Comments
 (0)