@@ -0,0 +1,1999 @@
+package org.hisp.dhis.android.core.trackedentity;%0A%0Aimport com.google.common.truth.Truth;%0A%0Aimport org.hisp.dhis.android.core.D2;%0Aimport org.hisp.dhis.android.core.common.D2Factory;%0Aimport org.hisp.dhis.android.core.common.State;%0Aimport org.hisp.dhis.android.core.data.database.AbsStoreTestCase;%0Aimport org.hisp.dhis.android.core.data.server.RealServerMother;%0Aimport org.junit.Before;%0A%0Aimport java.io.IOException;%0Aimport java.util.List;%0Aimport java.util.concurrent.Callable;%0A%0Apublic class TrackedEntityInstanceSyncDownCallRealIntegrationShould extends AbsStoreTestCase %7B%0A%0A    private D2 d2;%0A    private TrackedEntityInstanceStoreImpl store;%0A%0A    @Override%0A    @Before%0A    public void setUp() throws IOException %7B%0A        super.setUp();%0A%0A        d2 = D2Factory.create(RealServerMother.url, databaseAdapter());%0A        store = new TrackedEntityInstanceStoreImpl(databaseAdapter());%0A    %7D%0A%0A    //This test is commented because technically it is flaky.%0A    //It depends on a live server to operate and the login is hardcoded here.%0A    //Uncomment in order to quickly test changes vs a real server, but keep it uncommented after.%0A%0A    //@Test%0A    public void sync_down_synced_tracked_entity_instances() throws Exception %7B%0A        d2.logIn(RealServerMother.user, RealServerMother.password).call();%0A%0A        d2.syncMetaData().call();%0A%0A        Callable%3CList%3CTrackedEntityInstance%3E%3E trackedEntityInstanceCall =%0A                d2.downloadTrackedEntityInstances(2, false);%0A        List%3CTrackedEntityInstance%3E teiResponse = trackedEntityInstanceCall.call();%0A%0A        Truth.assertThat(teiResponse.size()).isEqualTo(2);%0A%0A        store.setState(teiResponse.get(0).uid(), State.TO_UPDATE);%0A%0A        Callable%3CList%3CTrackedEntityInstance%3E%3E syncDownSyncedTrackedEntityInstanceCall =%0A                d2.syncDownSyncedTrackedEntityInstances();%0A        List%3CTrackedEntityInstance%3E syncedTeiResponse = syncDownSyncedTrackedEntityInstanceCall.call();%0A%0A        Truth.assertThat(syncedTeiResponse.size()).isEqualTo(1);%0A    %7D%0A%7D%0A

add test