use of ai.grakn.exception.GraqlSyntaxException in project grakn by graknlabs.
the class GraqlControllerDeleteTest method DELETEMalformedGraqlQuery_ResponseStatusIs400.
@Test
public void DELETEMalformedGraqlQuery_ResponseStatusIs400() {
GraqlSyntaxException syntaxError = GraqlSyntaxException.create("syntax error");
when(tx.graql().parser().parseQuery("match $x isa ; delete;")).thenThrow(syntaxError);
String query = "match $x isa ; delete;";
Response response = sendRequest(query);
assertThat(response.statusCode(), equalTo(400));
}
use of ai.grakn.exception.GraqlSyntaxException in project grakn by graknlabs.
the class GraqlControllerDeleteTest method DELETEMalformedGraqlQuery_ResponseExceptionContainsSyntaxError.
@Test
public void DELETEMalformedGraqlQuery_ResponseExceptionContainsSyntaxError() {
GraqlSyntaxException syntaxError = GraqlSyntaxException.create("syntax error");
when(tx.graql().parser().parseQuery("match $x isa ; delete;")).thenThrow(syntaxError);
String query = "match $x isa ; delete;";
Response response = sendRequest(query);
assertThat(exception(response), containsString("syntax error"));
}
use of ai.grakn.exception.GraqlSyntaxException in project grakn by graknlabs.
the class GraqlControllerInsertTest method POSTMalformedGraqlQuery_ResponseExceptionContainsSyntaxError.
@Test
public void POSTMalformedGraqlQuery_ResponseExceptionContainsSyntaxError() {
GraqlSyntaxException syntaxError = GraqlSyntaxException.create("syntax error");
when(tx.graql().parser().parseQuery("insert $x isa ;")).thenThrow(syntaxError);
String query = "insert $x isa ;";
Response response = sendRequest(query);
assertThat(exception(response), containsString("syntax error"));
}
use of ai.grakn.exception.GraqlSyntaxException in project grakn by graknlabs.
the class GraqlControllerInsertTest method POSTMalformedGraqlQuery_ResponseStatusIs400.
@Test
public void POSTMalformedGraqlQuery_ResponseStatusIs400() {
GraqlSyntaxException syntaxError = GraqlSyntaxException.create("syntax error");
when(tx.graql().parser().parseQuery("insert $x isa ;")).thenThrow(syntaxError);
String query = "insert $x isa ;";
Response response = sendRequest(query);
assertThat(response.statusCode(), equalTo(400));
}
Aggregations