use of io.smallrye.graphql.client.impl.ResponseImpl in project smallrye-graphql by smallrye.
the class ResponseReaderTest method testGetObjectWhenResponseContainsList.
@Test
public void testGetObjectWhenResponseContainsList() {
ResponseImpl response = ResponseReader.readFrom(EXAMPLE_RESPONSE_TWO_ITEMS, null);
try {
response.getObject(Person.class, "people");
fail("Exception expected");
} catch (Exception e) {
assertTrue(e.getMessage().contains("SRGQLDC035007"));
}
}
use of io.smallrye.graphql.client.impl.ResponseImpl in project smallrye-graphql by smallrye.
the class ResponseReaderTest method nullResponse.
@Test
public void nullResponse() {
ResponseImpl response;
try {
response = ResponseReader.readFrom(null, Collections.emptyMap());
Assertions.fail();
} catch (InvalidResponseException ire) {
Assertions.assertTrue(ire.getMessage().contains("Response body was null"));
}
}
use of io.smallrye.graphql.client.impl.ResponseImpl in project smallrye-graphql by smallrye.
the class ResponseReaderTest method testGetListWhenResponseContainsObject.
@Test
public void testGetListWhenResponseContainsObject() {
ResponseImpl response = ResponseReader.readFrom(EXAMPLE_RESPONSE_ONE_ITEM, null);
try {
response.getList(Person.class, "people");
fail("Exception expected");
} catch (Exception e) {
assertTrue(e.getMessage().contains("SRGQLDC035006"));
}
}
use of io.smallrye.graphql.client.impl.ResponseImpl in project smallrye-graphql by smallrye.
the class ResponseReaderTest method testGetListWhenDataIsNull.
@Test
public void testGetListWhenDataIsNull() {
ResponseImpl response = ResponseReader.readFrom(EXAMPLE_RESPONSE_NULL_DATA, null);
assertNull(response.getList(Person.class, "people"));
}
use of io.smallrye.graphql.client.impl.ResponseImpl in project smallrye-graphql by smallrye.
the class ResponseReaderTest method testGetObject.
@Test
public void testGetObject() {
ResponseImpl response = ResponseReader.readFrom(EXAMPLE_RESPONSE_ONE_ITEM, null);
Person person = response.getObject(Person.class, "people");
assertEquals("jane", person.getName());
assertEquals(Gender.FEMALE, person.getGender());
}
Aggregations