You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fun `parser should verify subscription resolver return type`() {
669
+
class Subscription : GraphQLSubscriptionResolver {
670
+
fun onItemCreated(env: DataFetchingEnvironment) = env.hashCode()
671
+
}
672
+
668
673
val error = assertThrows(FieldResolverError::class.java) {
669
674
SchemaParser.newParser()
670
675
.schemaString(
@@ -689,17 +694,53 @@ class SchemaParserTest {
689
694
val expected = """
690
695
No method or field found as defined in schema <unknown>:3 with any of the following signatures (with or without one of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext] as the last argument), in priority order:
graphql.kickstart.tools.SchemaParserTest${"$"}parser should verify subscription resolver return type${"$"}Subscription.onItemCreated()
698
+
graphql.kickstart.tools.SchemaParserTest${"$"}parser should verify subscription resolver return type${"$"}Subscription.getOnItemCreated()
699
+
graphql.kickstart.tools.SchemaParserTest${"$"}parser should verify subscription resolver return type${"$"}Subscription.onItemCreated
695
700
696
701
Note that a Subscription data fetcher must return a Publisher of events
697
702
""".trimIndent()
698
703
699
704
assertEquals(error.message, expected)
700
705
}
701
706
702
-
class Subscription : GraphQLSubscriptionResolver {
703
-
fun onItemCreated(env: DataFetchingEnvironment) = env.hashCode()
707
+
@Test
708
+
fun `parser should verify subscription resolver generic future return type`() {
709
+
class Subscription : GraphQLSubscriptionResolver {
710
+
fun onItemCreated(env: DataFetchingEnvironment) = completedFuture(env.hashCode())
711
+
}
712
+
713
+
val error = assertThrows(FieldResolverError::class.java) {
714
+
SchemaParser.newParser()
715
+
.schemaString(
716
+
"""
717
+
type Subscription {
718
+
onItemCreated: Int!
719
+
}
720
+
721
+
type Query {
722
+
test: String
723
+
}
724
+
"""
725
+
)
726
+
.resolvers(
727
+
Subscription(),
728
+
object : GraphQLQueryResolver { fun test() = "test" }
729
+
)
730
+
.build()
731
+
.makeExecutableSchema()
732
+
}
733
+
734
+
val expected = """
735
+
No method or field found as defined in schema <unknown>:3 with any of the following signatures (with or without one of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext] as the last argument), in priority order:
736
+
737
+
graphql.kickstart.tools.SchemaParserTest${"$"}parser should verify subscription resolver generic future return type${"$"}Subscription.onItemCreated()
738
+
graphql.kickstart.tools.SchemaParserTest${"$"}parser should verify subscription resolver generic future return type${"$"}Subscription.getOnItemCreated()
739
+
graphql.kickstart.tools.SchemaParserTest${"$"}parser should verify subscription resolver generic future return type${"$"}Subscription.onItemCreated
740
+
741
+
Note that a Subscription data fetcher must return a Publisher of events
0 commit comments