use of com.jayway.restassured.response.Response in project grakn by graknlabs.
the class ConceptControllerTest method whenGettingTypesInstances_EnsureInstancesAreReturned.
@Test
public void whenGettingTypesInstances_EnsureInstancesAreReturned() throws JsonProcessingException {
// TODO: Same as below get jackson to deserialise via a child constructor
String request = entityTypeWrapper.instances().id();
Response response = RestAssured.when().get(request);
assertEquals(SC_OK, response.getStatusCode());
// Hacky way to check if instance is embedded
String instance = new ObjectMapper().writeValueAsString(entityWrapper);
response.then().body(containsString(instance));
}
use of com.jayway.restassured.response.Response in project grakn by graknlabs.
the class ConceptControllerTest method whenGettingKeysOfType_EnsureAttributesAreReturned.
@Test
public void whenGettingKeysOfType_EnsureAttributesAreReturned() throws IOException {
Response response = RestAssured.when().get(entityTypeWrapper.keys().id());
assertEquals(SC_OK, response.getStatusCode());
AttributeType[] keys = response.jsonPath().getObject("keys", AttributeType[].class);
assertThat(keys, arrayContainingInAnyOrder(attributeTypeKeyWrapper));
}
use of com.jayway.restassured.response.Response in project grakn by graknlabs.
the class ConceptControllerTest method whenGettingSubsOfSchemaConcept_EnsureSubsAreReturned.
@Test
public void whenGettingSubsOfSchemaConcept_EnsureSubsAreReturned() throws IOException {
Response response = RestAssured.when().get(entityTypeWrapper.subs().id());
assertEquals(SC_OK, response.getStatusCode());
EntityType[] subs = response.jsonPath().getObject("subs", EntityType[].class);
assertThat(subs, arrayContainingInAnyOrder(entityTypeWrapper, entityTypeSubWrapper));
}
use of com.jayway.restassured.response.Response in project grakn by graknlabs.
the class GraqlControllerInsertTest method POSTGraqlInsertWithJsonType_ResponseIsCorrectJson.
@Test
public void POSTGraqlInsertWithJsonType_ResponseIsCorrectJson() {
when(printer.graqlString(any())).thenReturn(Json.array().toString());
Response response = sendRequest("insert $x isa person;");
assertThat(jsonResponse(response).asJsonList().size(), equalTo(0));
}
use of com.jayway.restassured.response.Response in project grakn by graknlabs.
the class GraqlControllerInsertTest method POSTGraqlDefineNotValid_ResponseStatusCodeIs422.
@Test
public void POSTGraqlDefineNotValid_ResponseStatusCodeIs422() {
GraknTxOperationException exception = GraknTxOperationException.invalidCasting(Object.class, Object.class);
when(tx.graql().parser().parseQuery("define person plays movie;").execute()).thenThrow(exception);
Response response = sendRequest("define person plays movie;");
assertThat(response.statusCode(), equalTo(422));
}
Aggregations