use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class GistDescribeControllerTest method testDescribe_Total.
@Test
void testDescribe_Total() {
JsonObject description = GET("/users/gist?describe=true&total=true", getSuperuserUid()).content();
assertBaseDescription(description);
assertTrue(description.getObject("hql").has("count"));
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class InterpretationControllerTest method testPostComment.
@Test
void testPostComment() {
assertWebMessage("Created", 201, "OK", "Commented created", POST("/interpretations/" + uid + "/comments", "text/plain:comment").content(HttpStatus.CREATED));
JsonObject comments = GET("/interpretations/{uid}/comments", uid).content(HttpStatus.OK);
assertEquals(1, comments.getArray("comments").size());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class FollowupAnalysisControllerTest method assertFollowupValues.
private void assertFollowupValues(HttpResponse response, String... expectedComments) {
JsonResponse body = response.content();
JsonList<JsonFollowupValue> values = body.getList("followupValues", JsonFollowupValue.class);
assertEquals(expectedComments.length, values.size());
assertEquals(Arrays.stream(expectedComments).collect(toSet()), values.stream().map(JsonFollowupValue::getComment).collect(toSet()));
JsonObject metadata = body.getObject("metadata");
assertTrue(metadata.exists());
assertEquals(asList("de", "coc", "ou", "startDate", "endDate", "maxResults"), metadata.names());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class DimensionControllerTest method testGetDimensionsForDataSet.
@Test
void testGetDimensionsForDataSet() {
String dsId = assertStatus(HttpStatus.CREATED, POST("/dataSets/", "{'name':'My data set', 'periodType':'Monthly', 'categoryCombo':{'id':'" + ccId + "'}}"));
JsonObject response = GET("/dimensions/dataSet/{ds}", dsId).content();
JsonArray dimensions = response.getArray("dimensions");
assertEquals(1, dimensions.size());
JsonObject gender = dimensions.getObject(0);
assertEquals("Gender", gender.getString("name").string());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class DomainJsonResponseTest method testErrorSummary_MessageOnly.
@Test
void testErrorSummary_MessageOnly() {
JsonObject response = createJSON("{'message':'my message'}");
assertEquals("my message", response.as(JsonError.class).summary());
}
Aggregations