File tree Expand file tree Collapse file tree 5 files changed +35
-64
lines changed
src/test/kotlin/graphql/kickstart/tools Expand file tree Collapse file tree 5 files changed +35
-64
lines changed Original file line number Diff line number Diff line change @@ -2,17 +2,13 @@ package graphql.kickstart.tools
22
33import graphql.GraphQL
44import graphql.execution.AsyncExecutionStrategy
5- import org.junit.Before
5+ import graphql.schema.GraphQLSchema
66import org.junit.Test
77import java.util.*
88
99class BuiltInIdTest {
1010
11- private lateinit var gql: GraphQL
12-
13- @Before
14- fun setup () {
15- val schema = SchemaParser .newParser().schemaString("""
11+ private val schema: GraphQLSchema = SchemaParser .newParser().schemaString("""
1612 type Query {
1713 itemByLongId(id: ID!): Item1!
1814 itemsByLongIds(ids: [ID!]!): [Item1!]!
@@ -28,14 +24,12 @@ class BuiltInIdTest {
2824 id: ID!
2925 }
3026 """ .trimIndent())
31- .resolvers(QueryWithLongItemResolver ())
32- .build()
33- .makeExecutableSchema()
34- gql = GraphQL .newGraphQL(schema)
35- .queryExecutionStrategy(AsyncExecutionStrategy ())
36- .build()
37-
38- }
27+ .resolvers(QueryWithLongItemResolver ())
28+ .build()
29+ .makeExecutableSchema()
30+ private val gql: GraphQL = GraphQL .newGraphQL(schema)
31+ .queryExecutionStrategy(AsyncExecutionStrategy ())
32+ .build()
3933
4034 @Test
4135 fun `supports Long as ID as input` () {
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import graphql.*
44import graphql.execution.AsyncExecutionStrategy
55import graphql.schema.GraphQLEnumType
66import graphql.schema.GraphQLSchema
7- import org.junit.Before
87import org.junit.Test
98import org.reactivestreams.Publisher
109import org.reactivestreams.Subscriber
@@ -16,15 +15,10 @@ import java.util.concurrent.TimeUnit
1615
1716class EndToEndTest {
1817
19- private lateinit var gql: GraphQL
2018 private val schema: GraphQLSchema = createSchema()
21-
22- @Before
23- fun setup () {
24- gql = GraphQL .newGraphQL(schema)
25- .queryExecutionStrategy(AsyncExecutionStrategy ())
26- .build()
27- }
19+ private val gql: GraphQL = GraphQL .newGraphQL(schema)
20+ .queryExecutionStrategy(AsyncExecutionStrategy ())
21+ .build()
2822
2923 @Test
3024 fun `schema comments are used as descriptions` () {
Original file line number Diff line number Diff line change @@ -2,15 +2,11 @@ package graphql.kickstart.tools
22
33import graphql.GraphQL
44import graphql.execution.AsyncExecutionStrategy
5- import org.junit.Before
5+ import graphql.schema.GraphQLSchema
66import org.junit.Test
77
88class EnumListParameterTest {
9- private lateinit var gql: GraphQL
10-
11- @Before
12- fun setup () {
13- val schema = SchemaParser .newParser().schemaString("""
9+ private val schema: GraphQLSchema = SchemaParser .newParser().schemaString("""
1410 type Query {
1511 countries(regions: [Region!]!): [Country!]!
1612 }
@@ -26,14 +22,12 @@ class EnumListParameterTest {
2622 regions: [Region!]
2723 }
2824 """ .trimIndent())
29- .resolvers(QueryResolver ())
30- .build()
31- .makeExecutableSchema()
32- gql = GraphQL .newGraphQL(schema)
33- .queryExecutionStrategy(AsyncExecutionStrategy ())
34- .build()
35-
36- }
25+ .resolvers(QueryResolver ())
26+ .build()
27+ .makeExecutableSchema()
28+ private val gql: GraphQL = GraphQL .newGraphQL(schema)
29+ .queryExecutionStrategy(AsyncExecutionStrategy ())
30+ .build()
3731
3832 @Test
3933 fun `query with parameter type list of enums should resolve correctly` () {
Original file line number Diff line number Diff line change @@ -2,16 +2,12 @@ package graphql.kickstart.tools
22
33import graphql.GraphQL
44import graphql.execution.AsyncExecutionStrategy
5- import org.junit.Before
5+ import graphql.schema.GraphQLSchema
66import org.junit.Test
77
88class MultiResolverTest {
99
10- private lateinit var gql: GraphQL
11-
12- @Before
13- fun setup () {
14- val schema = SchemaParser .newParser().schemaString("""
10+ private val schema: GraphQLSchema = SchemaParser .newParser().schemaString("""
1511 type Query {
1612 person: Person
1713 }
@@ -25,14 +21,12 @@ class MultiResolverTest {
2521 name: String!
2622 }
2723 """ .trimIndent())
28- .resolvers(QueryWithPersonResolver (), PersonFriendResolver (), PersonNameResolver ())
29- .build()
30- .makeExecutableSchema()
31- gql = GraphQL .newGraphQL(schema)
32- .queryExecutionStrategy(AsyncExecutionStrategy ())
33- .build()
34-
35- }
24+ .resolvers(QueryWithPersonResolver (), PersonFriendResolver (), PersonNameResolver ())
25+ .build()
26+ .makeExecutableSchema()
27+ private val gql: GraphQL = GraphQL .newGraphQL(schema)
28+ .queryExecutionStrategy(AsyncExecutionStrategy ())
29+ .build()
3630
3731 @Test
3832 fun `multiple resolvers for one data class should resolve methods with arguments` () {
Original file line number Diff line number Diff line change @@ -2,16 +2,12 @@ package graphql.kickstart.tools
22
33import graphql.GraphQL
44import graphql.execution.AsyncExecutionStrategy
5- import org.junit.Before
5+ import graphql.schema.GraphQLSchema
66import org.junit.Test
77
88class ParameterizedGetterTest {
99
10- private lateinit var gql: GraphQL
11-
12- @Before
13- fun setup () {
14- val schema = SchemaParser .newParser().schemaString("""
10+ private val schema: GraphQLSchema = SchemaParser .newParser().schemaString("""
1511 type Query {
1612 human: Human
1713 }
@@ -25,13 +21,12 @@ class ParameterizedGetterTest {
2521 name: String!
2622 }
2723 """ .trimIndent())
28- .resolvers(QueryResolver (), HumanResolver ())
29- .build()
30- .makeExecutableSchema()
31- gql = GraphQL .newGraphQL(schema)
32- .queryExecutionStrategy(AsyncExecutionStrategy ())
33- .build()
34- }
24+ .resolvers(QueryResolver (), HumanResolver ())
25+ .build()
26+ .makeExecutableSchema()
27+ private val gql: GraphQL = GraphQL .newGraphQL(schema)
28+ .queryExecutionStrategy(AsyncExecutionStrategy ())
29+ .build()
3530
3631 @Test
3732 fun `parameterized query is resolved on data type instead of on its resolver` () {
You can’t perform that action at this time.
0 commit comments