@@ -0,0 +1,3159 @@
+package org.hisp.dhis.android.core.enrollment.note;%0A%0Aimport android.support.test.runner.AndroidJUnit4;%0A%0Aimport com.google.common.collect.Lists;%0A%0Aimport org.hisp.dhis.android.core.D2;%0Aimport org.hisp.dhis.android.core.common.D2Factory;%0Aimport org.hisp.dhis.android.core.common.ObjectWithoutUidStore;%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.hisp.dhis.android.core.trackedentity.TrackedEntityInstance;%0Aimport org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStore;%0Aimport org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStoreImpl;%0Aimport org.hisp.dhis.android.core.utils.CodeGeneratorImpl;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0Aimport java.io.IOException;%0A%0A@RunWith(AndroidJUnit4.class)%0Apublic class NotePostCallRealIntegrationShould extends AbsStoreTestCase %7B%0A    /**%0A     * A quick integration test that is probably flaky, but will help with finding bugs related to the%0A     * metadataSyncCall. It works against the demo server.%0A     */%0A    private D2 d2;%0A%0A    private TrackedEntityInstanceStore trackedEntityInstanceStore;%0A%0A%0A    @Before%0A    @Override%0A    public void setUp() throws IOException %7B%0A        super.setUp();%0A        trackedEntityInstanceStore = new TrackedEntityInstanceStoreImpl(databaseAdapter());%0A    %7D%0A%0A    @Test%0A    public void stub() throws Exception %7B%0A%0A    %7D%0A%0A    //@Test%0A    public void download_tei_add_one_note_and_sync_in_2_29() throws Exception %7B%0A        d2 = D2Factory.create(RealServerMother.url2_29, databaseAdapter());%0A        downloadUpdateAndSyncTei();%0A    %7D%0A%0A    //@Test%0A    public void download_tei_add_one_note_and_sync_in_2_30_or_more() throws Exception %7B%0A        d2 = D2Factory.create(RealServerMother.android_current, databaseAdapter());%0A        downloadUpdateAndSyncTei();%0A    %7D%0A%0A    public void downloadUpdateAndSyncTei() throws Exception %7B%0A        d2.logIn(RealServerMother.user, RealServerMother.password).call();%0A%0A        d2.syncMetaData().call();%0A%0A        d2.downloadTrackedEntityInstancesByUid(Lists.newArrayList(%22AlvUHPP2Mes%22)).call();%0A%0A        TrackedEntityInstance tei = trackedEntityInstanceStore.queryAll().values().iterator().next();%0A%0A        setTeiToPost(tei);%0A%0A        addNote();%0A%0A        d2.syncTrackedEntityInstances().call();%0A%0A        d2.wipeModule().wipeEverything();%0A    %7D%0A%0A    private void setTeiToPost(TrackedEntityInstance tei) %7B%0A        trackedEntityInstanceStore.update(%0A                tei.uid(), tei.created(), tei.lastUpdated(), tei.createdAtClient(), tei.lastUpdatedAtClient(),%0A                tei.organisationUnit(), tei.trackedEntityType(), tei.coordinates(), tei.featureType(),%0A                State.TO_POST, tei.uid());%0A    %7D%0A%0A    private void addNote() %7B%0A        ObjectWithoutUidStore%3CNote%3E noteStore = NoteStore.create(databaseAdapter());%0A        Note note = noteStore.selectFirst();%0A        noteStore.updateOrInsertWhere(note.toBuilder()%0A                .uid(new CodeGeneratorImpl().generate())%0A                .value(%22New note%22).state(State.TO_POST).build());%0A    %7D%0A%7D

Add NotePostCallRealIntegrationShould