use of org.hisp.dhis.webapi.json.domain.JsonWebMessage in project dhis2-core by dhis2.
the class PredictorControllerTest method testGetSkipTestDescription_InvalidExpression.
@Test
void testGetSkipTestDescription_InvalidExpression() {
JsonWebMessage response = POST("/predictors/skipTest/description", "1 <> 1").content().as(JsonWebMessage.class);
assertWebMessage("OK", 200, "ERROR", "Expression is not well-formed", response);
assertNull(response.getDescription());
}
use of org.hisp.dhis.webapi.json.domain.JsonWebMessage in project dhis2-core by dhis2.
the class PredictorControllerTest method testGetExpressionDescription_InvalidExpression.
@Test
void testGetExpressionDescription_InvalidExpression() {
JsonWebMessage response = POST("/predictors/expression/description", "1 <> 1").content().as(JsonWebMessage.class);
assertWebMessage("OK", 200, "ERROR", "Expression is not well-formed", response);
assertNull(response.getDescription());
}
use of org.hisp.dhis.webapi.json.domain.JsonWebMessage in project dhis2-core by dhis2.
the class UserControllerTest method testPostJsonObjectInvalidUsername.
@Test
void testPostJsonObjectInvalidUsername() {
JsonWebMessage msg = assertWebMessage("Conflict", 409, "ERROR", "One more more errors occurred, please see full details in import report.", POST("/users/", "{'surname':'S.','firstName':'Harry','userCredentials':{'username':'Harrys'}}").content(HttpStatus.CONFLICT));
JsonErrorReport report = msg.getResponse().find(JsonErrorReport.class, error -> error.getErrorCode() == ErrorCode.E4049);
assertEquals("username", report.getErrorProperty());
}
use of org.hisp.dhis.webapi.json.domain.JsonWebMessage in project dhis2-core by dhis2.
the class UserControllerTest method testPutProperty_InvalidWhatsapp.
@Test
void testPutProperty_InvalidWhatsapp() {
JsonWebMessage msg = assertWebMessage("Conflict", 409, "ERROR", "One more more errors occurred, please see full details in import report.", PATCH("/users/" + peter.getUid() + "?importReportMode=ERRORS", "[{'op': 'add', 'path': '/whatsApp', 'value': 'not-a-phone-no'}]").content(HttpStatus.CONFLICT));
JsonErrorReport report = msg.getResponse().find(JsonErrorReport.class, error -> error.getErrorCode() == ErrorCode.E4027);
assertEquals("whatsApp", report.getErrorProperty());
}
Aggregations