Search in sources :

Example 11 with AssetsFileReader

use of org.hisp.dhis.android.core.data.file.AssetsFileReader in project dhis2-android-sdk by dhis2.

the class EventEndPointCallMockIntegrationShould method parseEventResponse.

private Payload<Event> parseEventResponse(String file) throws IOException {
    String expectedEventsResponseJson = new AssetsFileReader().getStringFromFile(file);
    ObjectMapper objectMapper = new ObjectMapper().setDateFormat(BaseIdentifiableObject.DATE_FORMAT.raw());
    return objectMapper.readValue(expectedEventsResponseJson, new TypeReference<Payload<Event>>() {
    });
}
Also used : Payload(org.hisp.dhis.android.core.common.Payload) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) AssetsFileReader(org.hisp.dhis.android.core.data.file.AssetsFileReader)

Aggregations

AssetsFileReader (org.hisp.dhis.android.core.data.file.AssetsFileReader)11 Dhis2MockServer (org.hisp.dhis.android.core.data.server.Dhis2MockServer)9 Before (org.junit.Before)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 D2 (org.hisp.dhis.android.core.D2)3 ContentValues (android.content.ContentValues)2 Date (java.util.Date)2 ResourceStoreImpl (org.hisp.dhis.android.core.resource.ResourceStoreImpl)2 HashSet (java.util.HashSet)1 ObjectStyle (org.hisp.dhis.android.core.common.ObjectStyle)1 ObjectStyleModel (org.hisp.dhis.android.core.common.ObjectStyleModel)1 Payload (org.hisp.dhis.android.core.common.Payload)1 ValueTypeRendering (org.hisp.dhis.android.core.common.ValueTypeRendering)1 EnrollmentStoreImpl (org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl)1 RelationshipTypeStore (org.hisp.dhis.android.core.relationship.RelationshipTypeStore)1 RelationshipTypeStoreImpl (org.hisp.dhis.android.core.relationship.RelationshipTypeStoreImpl)1 ResourceStore (org.hisp.dhis.android.core.resource.ResourceStore)1 TrackedEntityAttributeStore (org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeStore)1 TrackedEntityAttributeStoreImpl (org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeStoreImpl)1 TrackedEntityInstanceStoreImpl (org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStoreImpl)1