use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class AbstractDataIntegrityControllerTest method getDetails.
protected final JsonDataIntegrityDetails getDetails(String check) {
JsonObject content = GET("/dataIntegrity/details?checks={check}&timeout=1000", check).content();
JsonDataIntegrityDetails details = content.get(check.replace('-', '_'), JsonDataIntegrityDetails.class);
assertTrue(details.exists(), "check " + check + " did not complete in time or threw an exception");
assertTrue(details.isObject());
return details;
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class DomainJsonResponseTest method testCustomObjectType.
@Test
void testCustomObjectType() {
JsonObject response = createJSON("{'user': {'id':'foo'}}");
assertEquals("foo", response.get("user", JsonUser.class).getId());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class DomainJsonResponseTest method testErrorSummary_MessageAndErrorReports.
@Test
void testErrorSummary_MessageAndErrorReports() {
JsonObject response = createJSON("{'message':'my message','response':{'errorReports': [{'errorCode':'E4000','message':'m1'}]}}");
assertEquals("my message\n" + " E4000 m1", response.as(JsonError.class).summary());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class DomainJsonResponseTest method testErrorSummary_MessageAndObjectReports.
@Test
void testErrorSummary_MessageAndObjectReports() {
JsonObject response = createJSON("{'message':'my message','response':{'objectReports':[{'klass':'java.lang.String','errorReports': [{'errorCode':'E4000','message':'m1'}]}]}}");
assertEquals("my message\n" + "* class java.lang.String\n" + " E4000 m1", response.as(JsonError.class).summary());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class AuthoritiesControllerTest method testGetAuthorities.
@Test
void testGetAuthorities() {
JsonArray systemAuthorities = GET("/authorities").content().getArray("systemAuthorities");
assertTrue(systemAuthorities.size() > 10);
// its sorted
JsonObject all = systemAuthorities.getObject(0);
assertEquals("ALL", all.getString("id").string());
assertEquals("ALL", all.getString("name").string());
}
Aggregations