@@ -116,7 +116,7 @@ public GraphQLTestSubscription init(@Nullable final Object payload) {
116116 sendMessage (message );
117117 state .setInitialized (true );
118118 awaitAcknowledgement ();
119- log .debug ("Subscription successfully initialized. " );
119+ log .debug ("Subscription successfully initialized" );
120120 return this ;
121121 }
122122
@@ -135,12 +135,12 @@ public GraphQLTestSubscription start(@NonNull final String graphQLResource) {
135135 /**
136136 * Sends the "start" message to the GraphQL Subscription.
137137 *
138- * @param graphGLResource the GraphQL resource, which contains the query for the subscription
138+ * @param graphQLResource the GraphQL resource, which contains the query for the subscription
139139 * start payload.
140140 * @param variables the variables needed for the query to be evaluated.
141141 * @return self reference
142142 */
143- public GraphQLTestSubscription start (@ NonNull final String graphGLResource ,
143+ public GraphQLTestSubscription start (@ NonNull final String graphQLResource ,
144144 @ Nullable final Object variables ) {
145145 if (!isInitialized ()) {
146146 init ();
@@ -150,7 +150,7 @@ public GraphQLTestSubscription start(@NonNull final String graphGLResource,
150150 }
151151 state .setStarted (true );
152152 ObjectNode payload = objectMapper .createObjectNode ();
153- payload .put ("query" , loadQuery (graphGLResource ));
153+ payload .put ("query" , loadQuery (graphQLResource ));
154154 payload .set ("variables" , getFinalPayload (variables ));
155155 ObjectNode message = objectMapper .createObjectNode ();
156156 message .put ("type" , "start" );
@@ -335,7 +335,7 @@ public List<GraphQLResponse> awaitAndGetNextResponses(
335335 }
336336
337337 private boolean hasReachedExpectedResponses (int numExpectedResponses ) {
338- return (state .getResponses ().size () < numExpectedResponses ) || numExpectedResponses <= 0 ;
338+ return (state .getResponses ().size () == numExpectedResponses ) || numExpectedResponses <= 0 ;
339339 }
340340
341341 /**
@@ -419,19 +419,20 @@ private void sendMessage(final Object message) {
419419
420420 private void awaitAcknowledgement () {
421421 awaitAcknowledgementOrConnection (GraphQLTestSubscription ::isAcknowledged ,
422- "Connection was not acknowledged by the GraphQL server." );
422+ "Connection was acknowledged by the GraphQL server." );
423423 }
424424
425425 private void awaitStop () {
426426 awaitAcknowledgementOrConnection (GraphQLTestSubscription ::isStopped ,
427- "Connection was not stopped in time." );
427+ "Connection was stopped in time." );
428428 }
429429
430430 private void awaitAcknowledgementOrConnection (final Predicate <GraphQLTestSubscription > condition ,
431431 final String timeoutDescription ) {
432432 await (timeoutDescription )
433433 .atMost (ACKNOWLEDGEMENT_AND_CONNECTION_TIMEOUT , TimeUnit .MILLISECONDS )
434434 .until (() -> condition .test (this ));
435+
435436 }
436437
437438 @ RequiredArgsConstructor
@@ -460,7 +461,6 @@ public void onMessage(final String message) {
460461 break ;
461462 case "data" :
462463 case "error" :
463- default :
464464 final JsonNode payload = jsonNode .get (PAYLOAD );
465465 assertThat (payload ).as ("Data/error messages must have a payload." ).isNotNull ();
466466 final String payloadString = objectMapper .writeValueAsString (payload );
0 commit comments