Search in sources :

Example 6 with InvalidResponseException

use of io.smallrye.graphql.client.InvalidResponseException in project smallrye-graphql by smallrye.

the class NestedBehavior method shouldFailToAssignStringToObject.

@Test
void shouldFailToAssignStringToObject() {
    fixture.returnsData("'greeting':'a'");
    ObjectApi api = fixture.build(ObjectApi.class);
    InvalidResponseException thrown = catchThrowableOfType(api::greeting, InvalidResponseException.class);
    then(thrown).hasMessage("invalid " + Greeting.class.getName() + " value for " + ObjectApi.class.getName() + "#greeting: \"a\"");
}
Also used : InvalidResponseException(io.smallrye.graphql.client.InvalidResponseException) Test(org.junit.jupiter.api.Test)

Example 7 with InvalidResponseException

use of io.smallrye.graphql.client.InvalidResponseException in project smallrye-graphql by smallrye.

the class NestedBehavior method shouldFailToAssignNumberToSet.

@Test
void shouldFailToAssignNumberToSet() {
    fixture.returnsData("'greetings':12345");
    StringSetApi api = fixture.build(StringSetApi.class);
    InvalidResponseException thrown = catchThrowableOfType(api::greetings, InvalidResponseException.class);
    then(thrown).hasMessage("invalid java.util.Set<java.lang.String> value for " + StringSetApi.class.getName() + "#greetings: 12345");
}
Also used : InvalidResponseException(io.smallrye.graphql.client.InvalidResponseException) Test(org.junit.jupiter.api.Test)

Example 8 with InvalidResponseException

use of io.smallrye.graphql.client.InvalidResponseException in project smallrye-graphql by smallrye.

the class NestedBehavior method shouldFailToAssignBooleanToObject.

@Test
void shouldFailToAssignBooleanToObject() {
    fixture.returnsData("'greeting':false");
    ObjectApi api = fixture.build(ObjectApi.class);
    InvalidResponseException thrown = catchThrowableOfType(api::greeting, InvalidResponseException.class);
    then(thrown).hasMessage("invalid " + Greeting.class.getName() + " value for " + ObjectApi.class.getName() + "#greeting: false");
}
Also used : InvalidResponseException(io.smallrye.graphql.client.InvalidResponseException) Test(org.junit.jupiter.api.Test)

Example 9 with InvalidResponseException

use of io.smallrye.graphql.client.InvalidResponseException in project smallrye-graphql by smallrye.

the class NestedBehavior method shouldFailToCallWrappedInvalidListByteQuery.

@Test
void shouldFailToCallWrappedInvalidListByteQuery() {
    fixture.returnsData("'container':{'codes':[97,98,9999],'count':3}");
    WrappedListByteApi api = fixture.build(WrappedListByteApi.class);
    InvalidResponseException thrown = catchThrowableOfType(api::container, InvalidResponseException.class);
    then(thrown).hasMessage("invalid java.lang.Byte value for " + WrappedListByteApi.class.getName() + "#container.codes[2]: 9999");
}
Also used : InvalidResponseException(io.smallrye.graphql.client.InvalidResponseException) Test(org.junit.jupiter.api.Test)

Example 10 with InvalidResponseException

use of io.smallrye.graphql.client.InvalidResponseException in project smallrye-graphql by smallrye.

the class NestedBehavior method shouldFailToAssignNumberToObject.

@Test
void shouldFailToAssignNumberToObject() {
    fixture.returnsData("'greeting':12.34");
    ObjectApi api = fixture.build(ObjectApi.class);
    InvalidResponseException thrown = catchThrowableOfType(api::greeting, InvalidResponseException.class);
    then(thrown).hasMessage("invalid " + Greeting.class.getName() + " value for " + ObjectApi.class.getName() + "#greeting: 12.34");
}
Also used : InvalidResponseException(io.smallrye.graphql.client.InvalidResponseException) Test(org.junit.jupiter.api.Test)

Aggregations

InvalidResponseException (io.smallrye.graphql.client.InvalidResponseException)25 Test (org.junit.jupiter.api.Test)15 WebSocketSubprotocolHandler (io.smallrye.graphql.client.vertx.websocket.WebSocketSubprotocolHandler)4 JsonObject (javax.json.JsonObject)4 JsonValue (javax.json.JsonValue)4 Map (java.util.Map)3 JsonString (javax.json.JsonString)3 GraphQLClientException (io.smallrye.graphql.client.GraphQLClientException)2 GraphQLError (io.smallrye.graphql.client.GraphQLError)2 ResponseReader (io.smallrye.graphql.client.impl.ResponseReader)2 ResultBuilder (io.smallrye.graphql.client.impl.typesafe.ResultBuilder)2 IncrementingNumberOperationIDGenerator (io.smallrye.graphql.client.vertx.websocket.opid.IncrementingNumberOperationIDGenerator)2 OperationIDGenerator (io.smallrye.graphql.client.vertx.websocket.opid.OperationIDGenerator)2 Uni (io.smallrye.mutiny.Uni)2 Cancellable (io.smallrye.mutiny.subscription.Cancellable)2 MultiEmitter (io.smallrye.mutiny.subscription.MultiEmitter)2 UniEmitter (io.smallrye.mutiny.subscription.UniEmitter)2 WebSocket (io.vertx.core.http.WebSocket)2 StringReader (java.io.StringReader)2 Duration (java.time.Duration)2