package org.hisp.dhis.android.core.enrollment;

import android.support.test.runner.AndroidJUnit4;

import org.hisp.dhis.android.core.data.database.MockIntegrationShould;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.List;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

@RunWith(AndroidJUnit4.class)
public class EnrollmentModuleMockIntegrationShould extends MockIntegrationShould {

    @BeforeClass
    public static void setUpAll() throws Exception {
        downloadMetadata();
        downloadTrackedEntityInstances();
    }

    @Test
    public void allow_access_to_all_enrollments_without_children() {
        List<Enrollment> enrollments = d2.enrollmentModule().enrollments.get();
        assertThat(enrollments.size(), is(1));
        for (Enrollment enrollment: enrollments) {
            assertThat(enrollment.uid(), is("JILLTkO4LKQ"));
            assertThat(enrollment.program(), is("lxAQ7Zs9VYR"));
            assertThat(enrollment.events() == null, is(true));
        }
    }

    @Test
    public void allow_access_to_one_enrollment_without_children() {
        Enrollment enrollment = d2.enrollmentModule().enrollments.uid("JILLTkO4LKQ").get();
        assertThat(enrollment.uid(), is("JILLTkO4LKQ"));
        assertThat(enrollment.program(), is("lxAQ7Zs9VYR"));
        assertThat(enrollment.events() == null, is(true));
    }
}
@@ -833,21 +833,22 @@
  is(
-1
+2
 ));%0A
+%0A
         
 for 
@@ -847,13 +847,8 @@
     
-for (
 Enro
@@ -868,9 +868,10 @@
 ment
-:
+ =
  enr
@@ -882,21 +882,25 @@
 ents
-) %7B%0A 
+.get(0);%0A
         
    a
@@ -887,35 +887,32 @@
 get(0);%0A        
-   
 assertThat(enrol
@@ -940,28 +940,24 @@
 TkO4LKQ%22));%0A
-    
         asse
@@ -1001,28 +1001,24 @@
 7Zs9VYR%22));%0A
-    
         asse
@@ -1068,18 +1068,8 @@
 ));%0A
-        %7D%0A
     

Update EnrollmentModuleMockIntegrationShould